数组中的最大项目 multi-select laravel blade 模板

max items in array multi-select laravel blade template

所以假设在我的 blade 模板中,我在 multi-select 中有 1000 多个项目,如下所示:

< select multiple='multiple' > 

@foreach($manyItems as $item) 

< option value= $item > $item </ option > 

@endforeach 

</ select > 

在此示例中,假设 $manyItems 有 2000 多个项目。现在,假设此 blade 模板的输入在 laravel 控制器中收集和处理。当我尝试 select 所有项目,以及更多项目时,由于某种原因它只 select 前 1000 个项目,并且它不能容纳更多数据(它丢弃其他 1000+项目,以及我 selected 的其他字段)。所以看起来 laravel blade 模板只能在 Request::all() 中传入 1000 个项目。这是真的? (或者我在四处游荡?) 为我加油吧。奇怪的错误警报。

我还禁用了我所有的 javascript 以验证这不是 javascript/jquery 造成的。

这不是 Laravel 问题,它与 PHP 引擎有关。

PHP 5.3.9引入了max_input_vars配置选项,默认值为1000。

How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). Use of this directive mitigates the possibility of denial of service attacks which use hash collisions. If there are more input variables than specified by this directive, an E_WARNING is issued, and further input variables are truncated from the request.

您可以通过更新服务器的 php.ini 或将其添加到 .htaccess 文件中来更改该值。