Php Laravel 4身份验证::尝试()问题
我正在尝试Laravel的Auth类,但该方法始终返回false。这是我的密码: 控制器:Php Laravel 4身份验证::尝试()问题,php,laravel,laravel-4,Php,Laravel,Laravel 4,我正在尝试Laravel的Auth类,但该方法始终返回false。这是我的密码: 控制器: public function postLogin() { // Declare the rules for the form validation. // $rules = array( 'email' => 'Required|Email', 'password' => 'Requ
public function postLogin()
{
// Declare the rules for the form validation.
//
$rules = array(
'email' => 'Required|Email',
'password' => 'Required'
);
// Get all the inputs.
//
$email = Input::get('email');
$password = Input::get('password');
// Validate the inputs.
//
$validator = Validator::make(Input::all(), $rules);
// Check if the form validates with success.
//
if ($validator->passes())
{
//echo $password; displays test
// Try to log the user in.
//
if (Auth::attempt(array('email' => $email, 'password' => $password)))
{
// Redirect to the users page.
//
return Redirect::to('account')->with('success', 'You have logged in successfully');
}
else
{
// Redirect to the login page.
//
return Redirect::to('account/login')->with('error', 'Email/password invalid.');
}
}
// Something went wrong.
//
return Redirect::to('account/login')->withErrors($validator->getMessageBag());
}
Seeder.php
公共功能运行()
{
DB::table('users')->delete()
}这将是因为框架缺陷。所以试着更新它
composer update
或
在config/auth.php文件中
尝试从“驱动程序”=>“雄辩”更改为“驱动程序”=>“数据库”。您确定收到$email和$password吗?然后用phpmyadmin检查你的数据库。是的,我收到了!您获得的帐户/登录存在验证错误或电子邮件/密码无效?我收到的电子邮件/密码无效错误可能是由于框架错误。所以,尝试使用composer update更新框架
composer update
php composer.phar update