This article mainly summarizes and introduces the usage of ini_set and ini_get functions in PHP. Friends in need can come and refer to it. I hope it will be helpful to everyone
The ini_set function in php is a function that comes with php to modify and set the php.iniconfiguration file. It is very convenient to use this function. There is no need to manually modify the php.ini file. Sometimes we There is no permission to modify the php.ini file, so use this function.
Example
Set an ini option
<?php echo ini_get('display_errors'); if (!ini_get('display_errors')) { ini_set('display_errors', '1'); } echo ini_get('display_errors'); ?>
ini_get is just the opposite of ini_set, used to get the value of the environment variable in the php.ini file.
ini_get — Gets the value of a configuration option. Successfully returns the string of the configuration option value. If the value is null, an empty string is returned. If the configuration option does not exist, FALSE will be returned.
ini_get() Example
echo ini_get('max_execution_time');//输出 30
If we want to get the variable values in the entire php.ini, we can use the enhanced function of ini_getini_get_all()It returns the entire php environment variables in the form of array.
The above is the detailed content of Usage of php ini_set and ini_get functions. For more information, please follow other related articles on the PHP Chinese website!