2016-11-11 68 views
0

我的代码test.blade.phpLaravel5.3引导错误

<div class="col-lg-10"> 
 
    {{ Form::text('movie', ['class' => 'form-control'])}} 
 
</div>

和错误在helpers.php线

ErrorException 519: 用htmlspecialchars()预计参数1为字符串,给定数组(Vi

回答

2

Form::text()的第二个参数应该是一个stri ng,但你想传递一个数组。这将工作:

{!! Form::text('movie', '', ['class' => 'form-control']) !!} 
+0

无论如何为什么'!!'在括号? – GiuServ

+0

@GluServ,在Laravel 5你应该使用'{!! !!}来显示未转义的数据(https://laravel.com/docs/5.3/blade#displaying-data)。在Laravel 4.2中[你应该使用](https://laravel.com/docs/4.2/templates#other-blade-control-structures)'{{}}' –

+0

{!! !!} {{}}不会转义字符串。这意味着如果您使用{{}},它会将标签显示为HTML。 – spicydog