laravel日常小问题

问题一:

在http/controllers/auth目录下创建AuthController.php,对应的视图文件也创建好,然后设置路由

routes.php文件:

Route::get('auth/login','AuthAuthController@getLogin');
发现一只访问不成功,报错一堆。如果将上句修改为
Route::get('auth','AuthAuthController@getLogin');//访问成功

Route::resource('auth/login','AuthAuthController@getLogin');//访问成功
可是根据手册上说的按理使用get访问也是可以的,查看了很久,尝试了很多,还是没有明白(刚接触,一脸懵逼),然后看到说php artisan dump-autoload使用这条命令,发现,也报错:

php artisan dump-autoload

 
 [SymfonyComponentConsoleExceptionCommandNotFoundException] 
 Command "dump-autoload" is not defined. 
 

然后又找,看到:由于Laravel是使用composer加载类的,如果不是使用命令创建的类是需要更新autoload的,需要 composer dump-autoload

然后也执行了下命令可以了。但是有疑问的是我的类也是使用命令来创建的,不知道为什么会这样。(难道是我忘记了,下次可以再试试看)

 
原文地址:https://www.cnblogs.com/-lin/p/7771946.html