Home  >  Article  >  Backend Development  >  php max_input_vars 导致提交数据丢失

php max_input_vars 导致提交数据丢失

WBOY
WBOYOriginal
2016-06-23 13:41:57806browse

一同事,让帮忙解决问题:post了1020条数据,结果只显示250条。 

判断可能是php的post设置问题,结果发现php.ini里关于post的设置没有问题。

通过 php://input 得到请求参数是完整的,就是在装入$_POST全局变量时有问题。

本以为很简单解决的问题,找了一个小时的原因。后来查看php这一部分源码看到这句代码:

if (++count > PG(max_input_vars)) {

                 php_error_docref(NULL TSRMLS_CC, E_WARNING, "Input variables exceeded %ld. To increase the limit change max_input_vars in     php.ini.", PG(max_input_vars));

                 return;

             } 

猛然间想起来,php5.3.10在解决hash冲突受攻击时,增加了一个配置指令max_input_vars。php.ini中增加这个指令的值即可。

其实,调试时打开php错误报告级别也可以看到有错误提示的。

绕了一大圈。


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn