在表單元素數目龐大的情況下有問題。一些元素不包含在帖子中。是否可以在運行時更改max_input_vars?
一番搜索後,我看到了這一點: $_POST max array size
$this->input->post('formelement') uses max_input_vars as limiter.
回答上面的鏈接就可以了。我知道我必須在php.ini中使用max_input_vars
。這在當地是可以的,但是如果我的生產服務器的webhosting公司不允許我在他們的服務器上更改此設置 - 這不是一個選項。
我使用笨和創建這樣一種形式:
<?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的?)
這回答了實際問題。但我有什麼選擇。我用htaccess做了什麼不正確的事情? – bestprogrammerintheworld
我得到錯誤:超出了max_input_var。請更改你的php.ini(或類似的東西) – bestprogrammerintheworld
好了,正如錯誤消息所示,請在php.ini中更改它。(對不起,如果這聽起來像我說的明顯) – hakre