W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
如何使用->即讀取配置文件,讓我們快點(diǎn)往下看吧!
在目錄結(jié)構(gòu)文檔頁(yè),可以看到service服務(wù)目錄下 有 config類
演示:
<?php namespace \test\app;
use \service\config;
class test
{
public function index()
{
//如果我要獲取默認(rèn)配置的debug情況
$debug = config::get('debug');
//如果我要獲取debug狀態(tài)如何
$switch = config::get('debug.switch');
//如果我要獲取其他配置文件的配置該如何獲取?
$other = config::get('xxx.sss.ooo','other');
}
}
怎么樣,看到這里,是否覺(jué)得很舒服?
官方提供的 config 服務(wù) 可取多維數(shù)組中的配置信息
列如:other.php 配置文件 , 你只需要 xxx.sss.ooo 就可以獲取到
return [ xxx=> [ sss=>[ ooo=>'你獲取到我了。' ] ] ]
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: