(Yaf >=1.0.0)
Yaf_Config_Ini锟斤拷锟斤拷锟斤拷锟斤拷通锟斤拷嵌锟阶的讹拷锟斤拷锟斤拷锟斤拷锟斤法锟斤拷应锟矫筹拷锟斤拷锟斤拷锟斤拷锟斤拷悉锟斤拷INI锟斤拷式锟芥储锟酵讹拷取锟斤拷锟斤拷锟斤拷锟捷★拷 INI锟斤拷式锟斤拷锟结供拥锟斤拷锟斤拷锟斤拷锟斤拷锟捷硷拷锟侥等硷拷锟结构锟斤拷锟斤拷锟斤拷锟斤拷锟捷斤拷之锟斤拷募坛锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷专锟斤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟捷等硷拷锟结构通锟斤拷锟矫碉拷锟斤拷呔锟斤拷(.)锟斤拷锟斤拷锟街碉拷锟� 一锟斤拷锟节匡拷锟斤拷锟斤拷展锟斤拷锟斤拷通锟斤拷锟节节碉拷锟斤拷锟斤拷之锟斤拷锟揭伙拷锟矫帮拷锟�(:)锟酵憋拷锟教承碉拷锟斤拷锟斤拷锟斤拷锟捷的节碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟节继承★拷
Note:
Yaf_Config_Ini锟斤拷锟斤拷PHP锟侥猴拷锟斤拷parse_ini_file()锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥硷拷锟侥★拷 锟斤拷锟斤拷细锟介看锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷牡锟斤拷锟阶拷锟斤拷锟斤拷锟揭恍╋拷锟斤拷锟斤拷锟酵撅拷锟斤拷约锟斤拷锟斤拷锟斤拷莞锟結af_Config_Ini锟斤拷一些锟斤拷锟斤拷 "TRUE", "FALSE","yes", "no", 锟斤拷"NULL"锟斤拷锟斤拷锟斤拷值锟侥达拷锟斤拷式
Example #1 Yaf_Config_Ini()example
锟斤拷锟斤拷锟斤拷锟剿碉拷锟斤拷锟绞癸拷锟結af_Config_Ini锟斤拷一锟斤拷INI锟斤拷锟斤拷锟侥硷拷锟叫伙拷取锟斤拷锟斤拷锟斤拷锟捷的伙拷锟斤拷锟矫凤拷锟斤拷 锟斤拷锟斤拷锟斤拷锟斤拷屑锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷梅锟斤拷锟揭诧拷锟斤拷锟绞撅拷锟斤拷锟斤拷锟斤拷锟斤拷梅锟斤拷锟斤拷锟� 锟斤拷为锟斤拷示锟斤拷锟斤拷锟斤拷锟斤拷锟矫革拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥非筹拷锟斤拷锟狡o拷锟斤拷锟斤拷锟斤拷示锟斤拷锟斤拷锟斤拷锟斤拷锟矫继筹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟矫★拷 锟节革拷锟接碉拷锟斤拷锟斤拷拢锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟侥o拷也锟斤拷锟斤拷写锟斤拷锟洁反锟侥★拷锟节革拷锟斤拷锟接碉拷锟斤拷锟斤拷拢锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷坛锟斤拷锟斤拷锟绞撅拷锟斤拷锟斤拷锟斤拷遣锟斤拷锟斤拷艿摹锟� 锟斤拷锟借,锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟捷讹拷锟斤拷锟斤拷锟斤拷/path/to/config.ini锟叫o拷
; Production site configuration data [production] webhost = www.example.com database.adapter = pdo_mysql database.params.host = db.example.com database.params.username = dbuser database.params.password = secret database.params.dbname = dbname ; Staging site configuration data inherits from production and ; overrides values as necessary [staging : production] database.params.host = dev.example.com database.params.username = devuser database.params.password = devsecret
<?php
$config = new Yaf_Config_Ini('/path/to/config.ini', 'staging');
var_dump($config->database->params->host);
var_dump($config->database->params->dbname);
var_dump($config->get("database.params.username"));
?>
锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�
string(15) "dev.example.com" string(6) "dbname" string(7) "devuser