php 如何更改 max_input_vars

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32602535/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 23:04:33  来源:igfitidea点击:

How to change max_input_vars

phpxampp

提问by Sakthivel

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

我有一个包含 1000 多个输入的表单,它显示以下警告:

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

警告:未知:输入变量超过 1000。要增加限制更改 php.ini 中的 max_input_vars。在未知的第 0 行

I have changed max_input_varsto more than 1500 in php.inifile but it does not take effect and shows the same error.

max_input_varsphp.ini文件中更改为 1500 多个,但它没有生效并显示相同的错误。

My project details:

我的项目详情:

  • Server: Localhost XAMP
  • PHP version: 5.5.15
  • System OS: windows 7
  • 服务器:Localhost XAMP
  • PHP 版本:5.5.15
  • 系统操作系统:windows 7

How can I clear this warning?

如何清除此警告?

回答by Jayesh D

ASH's suggested

ASH的建议

ini_set('max_input_vars','2000' );

but this never work with ini_set. You need to set it with php.inior .htaccessfile only.

但这永远不会与 ini_set 一起使用。您只需要使用php.ini.htaccess文件进行设置。

回答by Hitesh Tripathi

Add below code in your .htaccess file

在您的 .htaccess 文件中添加以下代码

php_value max_input_vars 2000

you can change value of 2000 to as per your need

您可以根据需要将 2000 的值更改为

回答by Mounish Ambaliya

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

对于 CentOs 服务器 -使用以下命令搜索加载的php.ini文件:

php -i | grep "Loaded Configuration File"

php -i | grep“加载的配置文件”

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

它显示加载的配置文件如下:

Loaded Configuration File => /etc/php.ini

加载的配置文件 => /etc/php.ini

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

使用 vi / vim 任意命令编辑文件,搜索:max_input_vars

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

默认值应为:1000,将其更改为:2000 或根据您的要求并在服务器上重新启动 PHP。

Works like charm for me always.

对我来说总是很有魅力。

回答by ASH

First call phpinfo()function than you will see:

phpinfo()您将看到的第一个调用函数:

max_input_vars = 1000

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

设置ini_set('max_input_vars','2000' );功能并重新启动Apache服务器。

回答by jignesh vasoya

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.

变量超过 1000。在 php.ini 中增加限制更改 max_input_vars。在 Unknown on line 0 这种类型的错误 Sloved 首先打开 php.ini 文件,然后找到“max_input_vars”Syntex,然后将其限制为 1000 到增量和 2000 设置。

回答by Krunal Modi

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.

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

回答by Krunal Modi

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.

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

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);