以巨大的形式存在多个表单元素的问题。帖子中没有包含一些元素。
经过一番搜索,我看到了这个: $_POST max array size
$this->input->post('formelement') uses max_input_vars as limiter.
上面的链接答案还可以。我知道我必须在php.ini中使用max_input_vars
。在本地可以,但如果我的生产服务器的网站托管公司不允许我在他们的服务器上更改此设置 - 这不是一个选项。
我正在使用codeIgniter并创建一个这样的表单:
<?php
$attributes = array('id' => 'id of form');
echo form_open('controller/function-name', $attributes);
//actual form content
echo form_close();
?>
经过进一步阅读后,我了解到我可以使用http://input
来绕过此max_input_var限制。
我可以在controller/function-name
$postdata = file_get_contents("php://input");
但是我必须手动检查csrf-values等,填充postdata,正确爆炸等等....
我也在htaccess中试过这个:(基于max_input_vars limited in PHP 5.2.17)
RewriteEngine On
RewriteBase /
php_value max_input_vars 6000
php_value suhosin.post.max_vars 6000
php_value suhosin.request.max_vars 6000
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
但是网页无法访问,而且我收到了内部错误。
我尝试进行更改的服务器正在使用PHP Version 5.5.7-1+sury.org~precise+1
是否可以在运行时更改max_input_vars
(或者我是否在使用htaccess时出错?)
答案 0 :(得分:3)
不,它无法在运行时更改它。
这是因为在运行时输入已经处理完毕。
因此设置要么已经导致错误,要么更改它为时已晚。
本手册中也记录了这一点,因为它列出了可以更改ini指令的位置:
如果您不确定更改PHP配置的所有位置以及如何使用它们,那么该部分中还有另一个页面: