的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