我有一个看起来像这样的表格:
{{ Form::open(array('route' => 'notebook.store', 'files' => true)) }}
{{ Form::text('title', null, [
'class'=>'form-control',
'placeholder'=>'Title',
]) }}
<br>
{{ Form::text('description', null, [
'class'=>'form-control',
'placeholder' => 'Desc',
])}}
<br>
{{ Form::file('path') }}
<br>
{{ Form::submit('Save', [
'class' => 'btn btn-primary btn-lg pull-right'
]) }}
<br><br>
{{ Form::close()}}
问题是,如果 'files'=>true
在表单描述中,我的 Controller 中的 Input::all()
返回一个空数组,当我删除它,问题就消失了,Input::all()
返回通常的预期输入。
编辑 - 我发现了问题所在。我的服务器在 php.ini 中的 post_max_size 非常低,如果文件超过该限制,显然它会清除所有发布/获取数据。
最佳答案
使用这个:
{{ Form::open(array('route' => 'notebook.store', 'enctype' => 'multipart/form-data')) }}
出于任何原因:
{{ Form::open(array('route' => 'notebook.store', 'files' => true)) }}
不起作用!
关于php - 当我添加 'files' => true 时,Laravel 表单不返回输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23189096/