Yaconf::getRetrieve a item 説明
public static mixed Yaconf::get(string
$name, mixed $default_value = NULL)
パラメータ
戻り値Returns configuration result(string or array) if the key exists, return default_value if not. 例例1 INIexample ;filenmame foo.ini, placed in directory which is yaconf.directoy [SectionA] ;key value pair key=val ;hash[a]=val hash.a=val ;arr[0]=val arr.0=val ;or arr[]=val ;SectionB inherits SectionA [SectionB:SectionA] ;override configuration key in SectionA key=new_val 上の例の出力は、 たとえば以下のようになります。
php7 -r 'var_dump(Yaconf::get("foo.SectionA.key"));'
//string(3) "val"
php7 -r 'var_dump(Yaconf::get("foo.SectionB.key"));'
//string(7) "new_val"
php7 -r 'var_dump(Yaconf::get("foo")["SectionA"]["hash"]);'
//array(1)
|