Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.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
Laravel 使用简单的身份验证驱动程序&x27;未初始化的字符串偏移量:0';_Laravel - Fatal编程技术网

Laravel 使用简单的身份验证驱动程序&x27;未初始化的字符串偏移量:0';

Laravel 使用简单的身份验证驱动程序&x27;未初始化的字符串偏移量:0';,laravel,Laravel,嗨,我一直在研究Laravel框架,但无法让这个身份验证驱动程序工作!返回: 未处理的异常 Message: Uninitialized string offset: 0 Location: C:\wamp\www\site\laravel\auth\drivers\eloquent.php on line 39 我有一个登录控制器,具有: class Login_Controller extends Base_Controller { public $restful = tru

嗨,我一直在研究Laravel框架,但无法让这个身份验证驱动程序工作!返回:

未处理的异常

Message:

Uninitialized string offset: 0
Location:

C:\wamp\www\site\laravel\auth\drivers\eloquent.php on line 39
我有一个登录控制器,具有:

class Login_Controller extends Base_Controller {

    public $restful = true;

    public function post_index()
    {
        $username = Input::get('username');
        $password = Input::get('password');

        if ( Auth::attempt($username, $password) )
        {
            return Redirect::to('home');
        }
        else
        {
            return Redirect::to('login')->with('login_errors', true);
        }

    }

    public function get_index() {

        return View::make('page.login');

    }

}
我有
“用户名”=>“用户名”,

在auth.php中输入行名称

还有其他人见过这个吗

问候


phil

确定找到它,需要通过数组将凭据传递给尝试方法:

<?php

class Login_Controller extends Base_Controller {

    public $restful = true;

    public function post_index()
    {
        $username = Input::get('username');
        $password = Input::get('password');

        if ( Auth::attempt( array( 'username' => $username, 'password' => $password ) ) )
        {
            return Redirect::to('home');
        }
        else
        {
            return Redirect::to('login')->with('login_errors', true);
        }

    }

    public function get_index() {

        return View::make('page.login');

    }

}