Laravel验证错误 [英] Laravel validate error
本文介绍了Laravel验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是错误
Symfony \组件\调试\异常\ FatalErrorException调用未定义的方法Illuminate \ Validation \ Validator :: make()
Symfony \ Component \ Debug \ Exception \ FatalErrorException Call to undefined method Illuminate\Validation\Validator::make()
这是我的代码
$validator = Validator::make($userdata,$rules);
if( $validator->fails() )
{
return View::make('default::partials.user.getregistration')->withErrors($validator)->withInput();
}
这是什么?
推荐答案
我相信您可能有
use Illuminate\Validation\Validator;
在您的文件中.(您的IDE可能认为这很有用.)要使用静态 ::
调用,应将 Validator
别名为 Illuminate \ Support \ Facades \ Validator 代码>.(默认情况下,\ app \ config \ app.php文件会为您执行此操作.)
in your file. (Your IDE probably thought it was being helpful.) To use the static ::
call, Validator
should be aliased to Illuminate\Support\Facades\Validator
. (The \app\config\app.php file does this for you by default.)
将use语句更改为
use \Validator;
将解决问题.
这篇关于Laravel验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文