PHP extension-config extension is used to load configuration options to the memory and optimize the configuration file loading process. Recommended scenarios: 1. you need to call the shared configuration in multiple projects and use config for management to avoid duplicate copy maintenance. 2. there are many configuration options. using config to load memory can avoid PHP expansion-config
Config extension is used to load configuration options to the memory and optimize the configuration file loading process.
Recommended scenarios:1. shared configurations need to be called in multiple projects and managed using config to avoid duplicate copy maintenance. 2. there are many configuration options. using config and loading memory can avoid PHP loading the configuration file for explanation and execution each time.
Project address: http://git.oschina.net/365690485/php_extension_config
Note: Currently, only PHP5.3.3 is tested and compiled in other versions.
Let's take a look at a simple config. ini:
; The parameter value length cannot exceed 255 [define]; ==================================== service center domain name ========== ===============; message forwarding server node MSG_SERVER_0 = http://msg0.20..cn/?user_service = == http://msg.service.#.cn/?config=max_upload_size = 2048login_redirect_url = http://login.service.10000.cn/
Syntax format:";" Indicates the option under [define], which is defined as a macro. it is equivalent to define (key, value). the client call method is echo MSG_SERVER_0 [config, indicates a linked list defined as key-value. The client call method is echo config ('max _ upload_size ')
Recommended scenarios:1. shared configurations need to be called in multiple projects and managed using config to avoid duplicate copy maintenance. 2. there are many configuration options. using config and loading memory can avoid PHP loading the configuration file for explanation and execution each time.
1. installation procedure (centos)1. install the PHP development environment
yum -y install php-devel
2. decompress the extension package
tar zxf config.tar.gz
3. go to the directory and compile and install
cd configphpize./configure --with-php-config=/usr/bin/php-configmake && make install
4. add a new line at the end of php. ini configuration.
Extension = config. so [config] config. path = absolute path of the configuration file
Download extension: config.tar.gz