PHP extension-"config"
The config extension is an implementation that loads configuration options into memory and optimizes the configuration file loading process.
Recommended Use scenarios:
1, multiple projects need to call the common configuration, using Config to manage, avoid multiple copies of copy maintenance.
2, a lot of configuration options, using config loaded into memory, you can avoid PHP every time the configuration file to interpret the execution.
Project Address:Http://git.oschina.net/365690485/php_extension_config
Note: Currently only Test compiled PHP5.3.3, other versions are not tested for compilation
first look at a simple config.ini:
Parameter value length cannot exceed 255[define];============================ service center domain name ======================; message forwarding server node one msg_server_0 = http://msg0.10000.cn/; User Service center URL user_service = http://user.service.10000.cn/; Message Service Center URL Msg_service = http://msg.service.10000.cn/[config]max_upload_size = 2048login_redirect_url = http ://login.service.10000.cn/
syntax Format:
“;” Start with comments
[Define] The following option, which represents the definition of a macro, is equivalent to define (key, value), which is called by the client: Echo msg_server_0
[Config], which represents the list defined as Key-value, the client invocation method: Echo config (' max_upload_size ')
Recommended Use scenarios:
1, multiple projects need to call the common configuration, using Config to manage, avoid multiple copies of copy maintenance.
2, a lot of configuration options, using config loaded into memory, you can avoid PHP every time the configuration file to interpret the execution.
First, installation Steps (CentOS)
1. Installing the PHP development environment
Yum-y Install Php-devel
2. Unzip the expansion pack
Tar zxf config.tar.gz
3. Go to directory, compile and install
CD configphpize./configure--with-php-config=/usr/bin/php-configmake && make install
4. Configure PHP.ini
End Line New
Extension = Config.so[config]config.path = Configuration file Absolute path
Extended Download: config.tar.gz