Summary of usage of ini_set and ini_get functions in PHP

The ini_set function in php is a function that comes with php to modify and set the php.ini configuration file. It is very convenient to use this function, and there is no need to manually modify the php.ini file. Sometimes we do not have permission to modify the php.ini file. Then use this function.

Syntax: ini_set("option", "value"); this function is best placed at the top of the php script

For example: ini_set("max_execution_time", "180");//Set the php script timeout to 180 seconds

For specific php options, please refer to the Configuration PHP Core section of the phpinfo file

ini_get is just the opposite of ini_set, used to get the value of the environment variable in the php.ini file.

Syntax: string ini_get (string varname ); returns the value of the option, or 0 or 1 if the value of the option is boolean

For example: echo ini_get('max_execution_time');//output 30

If we want to get the variable value in the entire php.ini, we can use the enhanced function ini_get ini_get_all() which returns the environment variables of the entire php in the form of an array.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325636501&siteId=291194637