In extension, sometimes the value set in PHP. ini needs to be used. In PHP extension, the INI variable is used as follows:
First use:
Php_ini_begin ()
Php_ini_entry ("foo_bar.global_value", "42", php_ini_all, null)
Php_ini_entry ("foo_bar.global_string", "foobar", php_ini_all, null)
Php_ini_end ()
Php_ini_begin (), php_ini_entry (), and php_ini_end () are some macros defined by Zend. After the preceding four statements are expanded, the result is as follows:
Static zend_ini_entry ini_entries [] =... {// begin Definition
... {0, php_ini_all, "foo_bar.global_value", sizeof ("foo_bar.global_value"), null, "42", sizeof ("42")-1, null, 0, 0, null },
... {0, php_ini_all, "foo_bar.global_string", sizeof ("foo_bar.global_string"), null, "foobar", sizeof ("foobar")-1, null, 0, 0, null },
... {0, 0, null, 0, null, 0, 0, null}; // end definition
It can be seen that all ini variables are placed in an array of the zend_ini_entry type. The array name is ini_entries.
In this case, only such a variable is defined. to use it, you need to call it within the minit method and use
Register_ini_entries (). The macro is defined as follows: # define register_ini_entries () zend_register_ini_entries (ini_entries, module_number tsrmls_cc)
In fact, zend_register_ini_entries () is called directly for registration and tsrm is mandatory.
To ensure the clean use of these ini variables, you must clear the registered ini variables during mshutdown and use the unregister_ini_entries () macro to complete the process. The definition is as follows: # define unregister_ini_entries () zend_unregister_ini_entries (module_number tsrmls_cc)