简体   繁体   中英

htmlentities() expects parameter 1 to be string, array given

I'm trying to add a class to a laravel form. The array is being passed as the third argument, as required, but I get the above error.

{{ Form::input('text', $variable->name, array('class' => 'form-control')) }}

If I get rid of the third argument, the form displays as expected (unstyled). I can't see what I'm doing wrong here - can anyone help?

{{ Form::text('text', $variable->name, array('class' => 'form-control')) }}

I can see from the api that there is another argument expected:

http://laravel.com/api/source-class-Illuminate.Html.FormBuilder.html#235-246

('text', $name, $value, $options)

Your array needs to be the fourth argument to Form::input() - the third is the 'default' value. See Laravel's FormBuilder class:

public function input($type, $name, $value = null, $options = array())

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM