【发布时间】:2015-04-03 08:51:34
【问题描述】:
我有几个array 类型的字段,我想通过使用Input::except() 来避免这些字段。我该怎么做? HTML 如下:
<tr>
<td>
{{ Form::input('text', 'batch_name[]', null, ['placeholder' =>'Enter batch name']) }}
</td>
<td>
{{ Form::input('date', 'availability_date[]', null) }}
</td>
<td>
<a class="add" title="Add Row" href="#"><img src="{{URL::to('public/assets/images/plus.png')}}" alt=""/></a>
</td>
</tr>
以下不起作用并给出错误:
htmlentities() 期望参数 1 是字符串,给定数组
Validator::make(Input::except('_token','batch_name[]','availability_date[]'), $rules);
【问题讨论】:
-
试试
Validator::make(Input::except('_token','batch_name','availability_date'), $rules);- 可以正常工作吗? -
只要把
batch_name从$rules中去掉,就不会被验证了。 -
@TheShiftExchange 不,不是。
标签: php validation laravel-4 input-field