laravel搭建登陆注册模块时出现错误。Class app\Controllers\GP\LoginController does not exist

来源:互联网 发布:360浏览器网络收藏夹 编辑:程序博客网 时间:2024/06/04 18:13
namespace APP\Controllers\GP;
class LoginController extends BaseController{    /**     * 返回登录首页     * 如果用户已经保存密码,则直接登录后台,否则用户显示登录界面     * @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View     */    public function anyIndex()    {        if (\Auth::check())            return \Redirect::to(U('GP/Login/index'));        return \View::make('GP.Login.index');    }
}
/*GP模块路由*/Route::group(array('prefix' => 'GP','namespace' => 'APP\Controllers\GP'), function() {    Route::controller('GP', 'LoginController', array(        'anyIndex' => 'GP.Login.index'    ));});

运行报错:
ReflectionException(-1)
Class APP\Controllers\GP LoginController does not exist
解决办法:
在PHPstorm Terminal控制台输入“composer dump-autoload”
因为laravel是用composer来加载类,不是命令创建的类要更新autoload。

0 0
原创粉丝点击