Install Yaconf on centos
What is Yaconf? You can see:
- Http://www.laruence.com/2015/06/12/3051.html
Installation:
git clone https://github.com/laruence/yaconf.gitcd yaconfphpize./configure --with-php-config=/usr/local/php/bin/php-config makemake install
Configure PHP. ini:
Vi/usr/local/php/etc/php. ini: [Yaconf] extension = yaconf. so # extension reference yaconf. directory =/home/web/conf # directory of the conf file yaconf. check_delay = 100 # Heartbeat check time. If it is 0, no check is performed. However, if it is modified, restart PHP.
Run:
-When PHP is loaded, it first searches for all INI files in/home/web/conf and parses them.-The parsed content is resident in the memory and calls PHP in php code. the ini value is called in the same format;
Set the INI File
/Home/web/conf/test. ini
foo="bar"phpversion=PHP_VERSION
Methods, only get and has methods:
# Read value: echo Yaconf: get ("test. foo "); // test is the name of the configuration file # determine whether this item has been set echo Yaconf: has (" test. foo "); // test is the name of the configuration file.
Special definition-array:
Definition:
arr[]=1arr.1=2
Read:
Yaconf: get ("test. arr.1"); # Read the specified Yaconf: get ("test. arr"); # Read the Array
Special definition-map type
Definition:
; You can use semicolons to write comments map2.foo. name = yaconfmap2.foo. year = 2015
Read:
Yaconf::get("test.map2.foo.name");
Special definition-group
Definition:
[parent]parent="base"children="NULL"[children:parent]children="children"
Read:
Yaconf: get ("test"); # An array in the KV format is returned. You can also use the. interval to access the array accurately.