Php configuration functions are several ini _ * functions. if the configuration file is manipulated for the next time, there are actually four functions: ini_get, ini_set, ini_get_all, and ini_restore. Groups think that ini_set and ini_get are the most useful.
Php configuration functions are several ini _ * functions. if the configuration file is manipulated for the next time, there are actually four functions: ini_get, ini_set, ini_get_all, and ini_restore. Groups think that ini_set and ini_get are the most useful.
* Ini_get (): gets the option value of the configuration file.
Many people believe this function is used to obtain the value of an option in the configuration file. if it is true, it goes to 1. if it is false, it goes to 0, and the string goes to the string.
For example, in the manual:
<? Php/* Our php. ini contains the following settings: display_errors = Onregister_globals = Offpost_max_size = 8 M */echo 'display _ errors = '. ini_get ('display _ errors '). "\ n"; // whether the echo 'register _ globals = 'can be opened when an error occurs '. ini_get ('register _ globals '). "\ n"; // whether the global variable can open echo 'post _ max_size = '. ini_get ('post _ max_size '). "\ n"; // maximum file size that can be submitted echo 'post _ max_size + 1 = '. (ini_get ('post _ max_size ') + 1 ). "\ n";?>
Input:
display_errors = 1register_globals = 0post_max_size = 8Mpost_max_size+1 = 9
This function can be easily manipulated to obtain the configuration file. For example, if you want to manipulate string filtering, but it is not clear whether magic_quotes_gpc has been opened, you can write a function like this:
/* String filter function */function stringFilter ($ str) {if (ini_get ('Magic _ quotes_gpc) ') {return $ str ;} else {return addslashes ($ str );}}
Of course, if you cannot know whether your global variables can be opened, you can also customize such functions:
/* Variable detection function */function getGetVar ($ var) {if (ini_set ('register _ gobals ') {return $ var ;} else {return $ _ GET ['var'];}
Of course, you can do a lot of useful work and I will gradually understand it.