在Laravel 5.6中重置密码链接

时间:2018-09-11 08:50:21

标签: laravel laravel-5 laravel-5.6

我收到此错误,htmlspecialchars()期望参数1为字符串,给定数组(视图:C:\ xampp \ htdocs \ blog \ resources \ views \ password \ reset.blade.php)“

这是我的重置刀片视图

enter code here
                {!! Form::open(['url'=> 'password/reset', 'method'=>"POST"]) !!}
                   {{ Form::label('email','Email Address:')}}
                   {{ Form::email('email',$email,['class' => 'form-control'])}}

                   {{ Form::hidden('token',$token)}}

                   {{ Form::label('password','New password:')}}
                   {{ Form::email('password',['class' => 'form-control'])}}

                   {{ Form::label('password_confirmation','Confirm New password:')}}
                   {{ Form::email('password_confirmation',['class' => 'form-control'])}}





                   <br>

                   {{ Form::submit('Reset password',['class' => 'btn btn-primary  btn-block'])}}
                {!! Form::close() !!}
                <br>
            </div>

这是我的方法

public function showResetForm(Request $request, $token = null)
{
    return view('password.reset')->with(
        ['token' => $token, 'email' => $request->email]
    );
}

1 个答案:

答案 0 :(得分:0)

您对字段使用了错误的语法。试试这个:

{!! Form::open(['url'=> 'password/reset', 'method'=>"POST"]) !!} 
{!! Form::label('email','Email Address:') !!}
{!! Form::email('email',$email,['class' => 'form-control'])!!}
{!! Form::hidden('token',$token)!!}
{!! Form::label('password','New password:')!!}
{!! Form::email('password',['class' => 'form-control'])!!}
{!! Form::label('password_confirmation','Confirm New password:')!!}
{!! Form::email('password_confirmation',['class' => 'form-control'])!!}
<br>
{!! Form::submit('Reset password',['class' => 'btn btn-primary  btn-block'])!!}
{!! Form::close() !!}

将所有{{替换为{!!,将}}替换为!!}。创建表单字段时,您不能使用{{ }}