我很難與Laravel 4驗證::嘗試方法,遵循正確的文檔,閱讀幾個SO線程,但仍然無法讓它工作。Laravel 4驗證:嘗試不工作
$userData = array('email' => '[email protected]','password' => 'admin');
if(Auth::attempt($userData)){
// redirect
}
else{
echo 'Invalid';
}
,並返回無效的每次
現在,我不知道什麼是真正的原因。
在我的配置/ auth.php我有以下
<?php
return array(
/*
|--------------------------------------------------------------------------
| Default Authentication Driver
|--------------------------------------------------------------------------
|
| This option controls the authentication driver that will be utilized.
| This drivers manages the retrieval and authentication of the users
| attempting to get access to protected areas of your application.
|
| Supported: "database", "eloquent"
|
*/
'driver' => 'eloquent',
/*
|--------------------------------------------------------------------------
| Authentication Model
|--------------------------------------------------------------------------
|
| When using the "Eloquent" authentication driver, we need to know which
| Eloquent model should be used to retrieve your users. Of course, it
| is often just the "User" model but you may use whatever you like.
|
*/
'model' => 'User',
/*
|--------------------------------------------------------------------------
| Authentication Table
|--------------------------------------------------------------------------
|
| When using the "Database" authentication driver, we need to know which
| table should be used to retrieve your users. We have chosen a basic
| default value but you may easily change it to any table you like.
|
*/
'table' => 'users',
/*
|--------------------------------------------------------------------------
| Password Reminder Settings
|--------------------------------------------------------------------------
|
| Here you may set the settings for password reminders, including a view
| that should be used as your password reminder e-mail. You will also
| be able to set the name of the table that holds the reset tokens.
|
*/
'reminder' => array(
'email' => 'emails.auth.reminder', 'table' => 'password_reminders',
),
);
?>
我告訴過你的問題的答案,downvote它所有你想要的。你的數組密鑰是錯誤的,yoyur登錄將保持失敗。玩的開心。 – CreativityKills
你不應該擔心倒票,你認爲如果嘗試了幾種組合,電子郵件或用戶名至少在laravel4中是不需要的選項http://laravel.com/docs/security。閱讀此文檔以獲得更好的理解.... –
我想你的意思是鏈接到[Laravel 4的文檔。](http://four.laravel.com/docs/security)我現在遇到類似的問題。一旦我找到答案,我會試着在這裏發帖。 –