【问题标题】:Error when listing all routes in Laravel, ReflectionException Class "Postcontroller" does not exist在 Laravel 中列出所有路由时出错,ReflectionException Class \"Postcontroller\" does not exist
【发布时间】:2023-01-30 01:57:29
【问题描述】:

使用 Postcontroller 创建了一个基本的 laravel 应用程序

php artisan make:controller Postcontroller --resource

但是在列出路线时 (php artisan route:list)

它显示错误“后控制器”类不存在尽管它存在。

【问题讨论】:

  • 它认为您指的是 Postcontroller 而不是 App\Http\Controllers\Postcontroller 的事实很有趣……除了显示的内容之外,还有其他地方引用该控制器吗?
  • 重新开始,使用指令php artisan make:model Post -mcr
  • 你跑了吗php工匠路线:清除

标签: php laravel


【解决方案1】:

请仔细检查 Postcontroller.php 中的类名是否正确。

namespace AppHttpControllers;

class Postcontroller extends Controller{

}

然后,清除缓存:

php artisan cache:clear
php artisan config:clear
php artisan route:cache

【讨论】:

猜你喜欢
  • 2016-09-03
  • 2019-04-29
  • 1970-01-01
  • 2020-10-03
  • 1970-01-01
  • 2022-11-09
  • 2017-06-07
  • 2018-12-08
  • 2021-10-09
相关资源
最近更新 更多