Stack trace: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'syntax error, unexpected '}'' in D:\xampp\htdocs\guestlara\app\controllers\LoginController.php:23
public function login_user()
{
$rules = array(
'email'=> 'Required|Between:3,64|Email|Unique:users',
'password'=>'Required|AlphaNum|Between:4,8|Confirmed',
);
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
// get the error messages from the validator
$messages = $validator->messages();
// redirect our user back to the form with the errors from the validator
return Redirect::to('/')
->withErrors($validator);
log::error($validator)
}
else
{
// attempt to do the login
if (Auth::attempt($users)) {
return Redirect::to('dashboard');
} else {
return Redirect::to('/');
}
}
}
最佳答案
缺少;
-
return Redirect::to('/')
->withErrors($validator);
log::error($validator); // Here
} else {
小变化。
log::error($validator);
不会被执行,因为该操作将在到达 log::error()< 之前
。所以应该是 - 返回
/
log::error($validator);
return Redirect::to('/')
->withErrors($validator);
关于php - laravel 验证语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36443749/