的ErrorException發生在我的代碼$用戶>密碼=哈希::使(輸入::得到( '密碼')); 說password_hash():密碼必須是一個字符串。我使用laravel框架錯誤:password_hash():密碼必須是laravel字符串
$user = new User();
$user->username = Input::get('username');
$user->password = Hash::make(Input::get('password'));
if($user->save())
{
return Redirect::route('home')->with('success','You register successfully. You can now login');
} else {
return Redirect::route('home')->with('fail','An error occurred while creating user. Please try again.');
}
你應該編輯你的問題,並在那裏寫上你的表單代碼 – 2014-09-25 10:25:15
大概'Input :: get('password')'不包含任何值,所以我會檢查你的HTML表單是否真的有這個名字的輸入字段。 – martinstoeckli 2014-09-25 11:13:51
@martinstoeckli我已經檢查過它,但它似乎即使你沒有輸入,你也不會看到這樣的錯誤。 – 2014-09-25 17:05:19