【发布时间】:2014-07-14 06:05:41
【问题描述】:
在一个巨大的表单中存在大量表单元素的问题。某些元素未包含在帖子中。
经过一番搜索,我看到了这个: $_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 值等,填充 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 中做错了什么?)
【问题讨论】:
标签: php forms codeigniter input