简体   繁体   中英

How to change max_input_vars

I have a form with over 1000 inputs, it shows warning below:

Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0

I have changed max_input_vars to more than 1500 in php.ini file but it does not take effect and shows the same error.

My project details:

  • Server: Localhost XAMP
  • PHP version: 5.5.15
  • System OS: windows 7

How can I clear this warning?

ASH's suggested

ini_set('max_input_vars','2000' );

but this never work with ini_set. You need to set it with php.ini or .htaccess file only.

First call phpinfo() function than you will see:

max_input_vars = 1000

set ini_set('max_input_vars','2000' ); in function and restart Apache server.

Variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0 This Type of error Sloved the first to open php.ini file and after find "max_input_vars" Syntex and After his limit to 1000 to incres and 2000 set.

使用java脚本将数组转换为使用逗号分隔的字符串,然后将值作为字符串传递给控制器​​并将值拆分为控制器中的特定字符并将字符串转换为控制器中的数组。

convert array to string with comma separate from view using java script, then pass value to controller as string & split value to specific character in controller & convert string to array in controller.

 in Javascript : array store in list variable var str = ""; for(var i=0;i<list.length;i++) { str = str + list[i] + ','; } var len = str.length; return str.substring(0,len-1); in PHP explode this string & convert to array. $searchValue = explode(",", $searchValue); 

Add below code in your .htaccess file

php_value max_input_vars 2000

you can change value of 2000 to as per your need

For CentOs server - Search for php.ini file loaded using below command :

php -i | grep "Loaded Configuration File"

It displays's the loaded configuration file as per below :

Loaded Configuration File => /etc/php.ini

Edit the file using vi / vim any command, search for : max_input_vars

Default value shall : 1000, Change it to : 2000 or as per your requirement and Restart the PHP on server.

Works like charm for me always.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM