我的表单代码:
<p>{!!Form::open(array("","id"=>"form"))!!}</p>
<p>Initial barcode :  </p>
<p>{!! Form::text('initialbarcode',array("id"=>"initialbarcode"))!!}</p>
<p>Barcode3 :  </p>
<p>{!! Form::text('barcode3',array("id"=>"barcode3"))!!}</p>
<p>Quantity :  </p>
<p>{!! Form::text('qty',array("id"=>"qty"))!!}</p>
<p>Kgs :  </p>
<p>{!! Form::text('kgs',array("id"=>"kgs"))!!}</p>
<p>Price :  </p>
<p>{!! Form::text('price',array("id"=>"price"))!!}</p>
<p>{!! Form::text('name',array("id"=>"name"))!!}</p>
<p><select name="category" id="category"></p>
@foreach($options as $option)
<option>{{$option->category}}</option>
@endforeach
</select>
<p>{!! Form::close()!!}</p>
此处此代码返回以下错误: htmlentities()期望参数1为字符串,给定数组(查看:C:\ Users \ Toshiba \ farmzop \ resources \ views \ nonfz \ nonfz.blade.php)
答案 0 :(得分:1)
请注意Form::text
方法的签名:
/**
* Create a text input field.
*
* @param string $name
* @param string $value
* @param array $options
*
* @return string
*/
public function text($name, $value = null, $options = [])
只需改变:
{!! Form::text('initialbarcode',array("id"=>"initialbarcode"))!!}
到
{!! Form::text('initialbarcode', null, ["id"=>"initialbarcode"]) !!}