问题
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?
回答1:
{{ Form::text('text', $variable->name, array('class' => 'form-control')) }}
回答2:
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)
回答3:
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())
来源:https://stackoverflow.com/questions/21732931/htmlentities-expects-parameter-1-to-be-string-array-given