Home >Backend Development >PHP Tutorial >laravel-Laravel5.1中使用自带用户认证出错302

laravel-Laravel5.1中使用自带用户认证出错302

WBOY
WBOYOriginal
2016-06-02 11:28:541616browse

laravelphp

注册和登录时,验证正确没问题,验证错误就会出302错误,跳转到原来的页面。
google了上面看不太懂,有个说在AuthController中添加这个函数:

<code> public function postRegister(Request $request)    {        $validator = $this->validator($request->all());        if ($validator->fails()) {            $this->throwValidationException(                $request, $validator            );        }        $this->create($request->all());        return response()->json([ 'message' => 'Registered Complete!' ], 200);    }</code>

但我添加了,效果是一样的。

我感觉错误是$this->throwValidationException($request, $validator);导致的,但是我不知道怎么解决,求助各位。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn