![](/img/trans.png)
[英]Laravel htmlentities() expects parameter 1 to be string, array given
[英]htmlentities() expects parameter 1 to be string, array given
我正在嘗試將一個類添加到laravel表單中。 根據需要,數組作為第三個參數傳遞,但是我得到了上面的錯誤。
{{ Form::input('text', $variable->name, array('class' => 'form-control')) }}
如果我擺脫第三個參數,表單將按預期顯示(無樣式)。 我無法看到我在這里做錯了什么 - 有人可以幫忙嗎?
{{ Form::text('text', $variable->name, array('class' => 'form-control')) }}
我可以從api看到預期還有另一個論點:
http://laravel.com/api/source-class-Illuminate.Html.FormBuilder.html#235-246
('text', $name, $value, $options)
你的數組需要是Form::input()
的第四個參數 - 第三個是'default'值。 請參閱Laravel的FormBuilder
類:
public function input($type, $name, $value = null, $options = array())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.