Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 拉威尔认证_Php_Laravel_Authentication - Fatal编程技术网

Php 拉威尔认证

Php 拉威尔认证,php,laravel,authentication,Php,Laravel,Authentication,我使用了allready是laravel应用程序的身份验证代码。除了一个我找不到的错误外,它工作正常。我在my routes.php中创建了一个“/home”路由。过了一段时间,我取消了这条路线,因为我不再需要她了 现在我的问题是,我的网站在每次登录/注销/注册时都会让我感到困惑。第一个站点是登录脚本。假设我的数据库中没有帐户。所以我正在创建一个新帐户。在注册公式之后,我被引导到我的(不在我的路由中。php现有/主路由中) 之后,我将注销我的帐户并尝试登录脚本。有时我会被引导到我的博客(应该是这

我使用了allready是laravel应用程序的身份验证代码。除了一个我找不到的错误外,它工作正常。我在my routes.php中创建了一个“/home”路由。过了一段时间,我取消了这条路线,因为我不再需要她了

现在我的问题是,我的网站在每次登录/注销/注册时都会让我感到困惑。第一个站点是登录脚本。假设我的数据库中没有帐户。所以我正在创建一个新帐户。在注册公式之后,我被引导到我的(不在我的路由中。php现有/主路由中)

之后,我将注销我的帐户并尝试登录脚本。有时我会被引导到我的博客(应该是这样的)。但有时它只是把我引向(仍然不存在的)/回家路线。我真的不知道为什么。。在my routes.php中没有任何/主路径。我查看了AuthController/PasswordController以及中间件字典中的所有文件,没有找到一个返回/重定向到任何名为/home的路由的视图

有人知道为什么我也可以搜索到代码中指向/主路线的部分吗

Route::get('/', function(){
    if(Auth::guest())
        return Redirect::to('auth/login');
    else
        return view('test/index');
    });

// Authentication routes...
Route::get('auth/login', 'Auth\AuthController@getLogin');
Route::post('auth/login', 'Auth\AuthController@postLogin');
Route::get('auth/logout', 'Auth\AuthController@getLogout');

// Registration routes...
Route::get('auth/register', 'Auth\AuthController@getRegister');
Route::post('auth/register', 'Auth\AuthController@postRegister');

问题是,默认情况下,Laravel 5会自动将您重定向到/home

查看
AuthController.php
并更改为:

protected $redirectTo = '/';

另外,您也可以创建一些路由重定向。

我在authController上。但是我应该在哪里输入:protected$redirectTo='/';它受保护
$redirectTo='/home'。这是在
\u construct
方法之前。请更新您的问题/标签以包含laravel版本