本文介绍了帖子数组被截断,max_input_vars不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个管理后端带有级联选项插件的opencart解决方案.这样,在保存表单时,具有大量选项的产品会创建大型的$ _POST数组.

I'm developing an opencart solution with a cascading option plugin in the admin backend. As such, when saving the form, products with a large combination of options are creating large $_POST arrays.

据我所知,该数组(该产品的长度刚好超过1000个键)被截断了1000个标记(符合max_input_vars的默认值).

As far as I can see, the array (which is just over 1000 keys long for this product) is being truncated around the 1000 mark (which fits in with the default value of max_input_vars).

我在php 5.3.29上,它应该允许我更改max_input vars ini设置.我已经添加到本地php.ini,还尝试了服务器php.ini.我的phpinfo()说max_input_vars:3000,但数组在同一点仍被截断.

I am on php 5.3.29 which should allow me to change max_input vars ini setting. I have added to the local php.ini and also tried the server php.ini. My phpinfo() says max_input_vars: 3000, but the array is still truncating at the same point.

我推测这不是post_max_size错误,因为向较小的关键post变量中添加伪文本不会在其他地方截断,但是不确定是否有任何其他ini变量会影响这一点.

I have surmised that it's not a post_max_size error as adding dummy text into smaller key post variables does not truncate at a different point, but am not sure if any other ini variables could affect this.

我还检查了Charles调试器,肯定会完整地张贴整个帖子数组.

I have also checked in Charles debugger, the full post array is definitely being posted across.

有什么建议吗?

推荐答案

我遇到了同样的问题,我通过在此php.ini中设置max_input_vars值来解决此问题:/etc/php5/apache2/php.ini

I had the same issue, and I fixed it by setting max_input_vars value in this php.ini:/etc/php5/apache2/php.ini

即使php_info()报告使用了不同的php.ini(/etc/php5/cli/php.ini).顺便说一句,在我偶然发现该解决方案之前,我还尝试在.htaccess(在网页根目录中)中设置该值,但没有任何效果.

even though php_info() reported a different php.ini used (/etc/php5/cli/php.ini). BTW, before I stumbled upon the solution, I also tried setting up the value in .htaccess (in the web page root directory), with no effect.

这似乎是PHP 5.5中可能的错误.无论如何,我建议您在服务器上找到所有php.ini文件(找到php.ini"),并在所有文件中设置max_input_vars(或第一个起作用的文件eh).不要忘记重启Apache,这样才能生效(sudo/etc/init.d/apache2 restart)

This looks like a possible bug in PHP 5.5. In any case, I suggest locating all php.ini files on your server ("locate php.ini") and setting max_input_vars in all of them (or the first one that works, eh). Don't forget to restart Apache so this takes effect (sudo /etc/init.d/apache2 restart)

顺便说一句,我的PHP版本是5.5.9-1ubuntu4.5,已安装在Ubuntu 14.04上.

BTW, my PHP Version is 5.5.9-1ubuntu4.5, installed on Ubuntu 14.04.

这篇关于帖子数组被截断,max_input_vars不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 16:54