我将app / controllers更改为app / Controllers,添加到composer.json文件中:
"psr-0": {
"Controllers": "app/",
"Test":"app/"
}
在我的控制器中,我添加:
namespace Controllers;
当我使用作曲家更新时,出现以下错误:
L:\USB\Test>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
{"error":{"type":"ReflectionException","message":"Class RemindersController does
not exist","file":"L:\\USB\\Test\\vendor\\laravel\\framework\\src\\Illuminate\
\Routing\\ControllerInspector.php","line":28}}{"error":{"type":"ReflectionExcept
ion","message":"Class RemindersController does not exist","file":"L:\\USB\\Test
\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerInspector.php"
,"line":28}}
答案 0 :(得分:3)
因为你添加了一个命名空间" Controllers"对于之前没有它们的类,你是否也更新了所有使用控制器名称的路由? 例如:
Route::controller('reminders', '\Controllers\RemindersController');
和
route(\Controllers\RemindersController@getIndex);