$_POST最大数组大小

27

我有一个非常大的表单,其中包含1000多个元素。它们已经嵌套在表单的html结构中。

                {foreach from=$result item=item}
                    <tr>
                        <td><input type="text" value="{$item.receiver.name}" name="item[{$item.id}][receiver][name]" /></td>
                        <td><input type="text" value="{$item.receiver.account_number}" name="item[{$item.id}][receiver][account_number]" /></td>
                        <td><input type="text" value="{$item.receiver.bank_code}" name="item[{$item.id}][receiver][bank_code]" /></td>
                        <td><input type="text" value="{$item.amount}" name="item[{$item.id}][amount]" /></td>
                        <td><input type="text" value="{$item.usage.first}" name="item[{$item.id}][usage][first]" /></td>
                        <td><input type="text" value="{$item.usage.second}" name="item[{$item.id}][usage][second]" /></td>
                        <td><input type="text" value="Yourdelivery GmbH" name="item[{$item.id}][usage][third]" /></td>
                        <td>
                            <input type="checkbox" value="1" name="item[{$item.id}][import]" />
                        </td>
                    </tr>
                {/foreach}

我正在创建一个用于批量银行交易的DATAUS文件。但是在超过1000行后,$_POST数组不再添加元素,并且调试器显示以下元素计数。

Xdebug Output

我已经将max_post_size设置为100M以进行测试,但没有帮助。


1
你的服务器上安装了Suhosin吗?在命令行上运行 php -i | grep -i 'Suhosin' 来查找。请参阅 suhosin.post.max_varssuhosin.post.max_array_index_length - Treffynnon
这个建议有帮助吗?链接 - Ry-
当我需要模拟MYSQL控制台时,我遇到了类似的问题...我使用了$_SESSION变量,这样我就可以传递长字符串(超过1k行)而没有问题。 - Charles Forest
是的,服务器受到Suhosin保护。我尝试修复max_array_index_length变量。 - MatthiasLaug
我已经在php.ini中添加了suhosin.post.max_array_index_length = 100000,但没有帮助。 - MatthiasLaug
1个回答

56

1
更多信息的链接非常有帮助,解决了我的问题。一个小提示:在OS X Mountain Lion中,php.ini文件的位置是**/private/etc/php.ini。我已经发现可以使用php --ini**命令。 - csonuryilmaz
刚刚救了我的一整天! - msbomrel
我已经更新了max_input_vars = 5000,但在我的表单更新中没有反映出来。 - Raman Joshi
这个答案非常有用,我也在这里链接了它:https://stackoverflow.com/a/63169511/11787139 - Kay Angevare

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接