阅读(556) (0)

如何使用?

2017-11-23 19:53:19 更新

使用介绍

如何使用->即读取配置文件,让我们快点往下看吧!

在目录结构文档页,可以看到service服务目录下 有 config类

演示:

<?php namespace \test\app;


use \service\config;


class test
{
    public function index()
    {
        //如果我要获取默认配置的debug情况
        $debug = config::get('debug');

        
        //如果我要获取debug状态如何
        $switch = config::get('debug.switch');


        //如果我要获取其他配置文件的配置该如何获取?
        $other = config::get('xxx.sss.ooo','other');
    }
}

怎么样,看到这里,是否觉得很舒服?

官方提供的 config 服务 可取多维数组中的配置信息

列如:other.php 配置文件 , 你只需要 xxx.sss.ooo 就可以获取到

return [ xxx=> [ sss=>[ ooo=>'你获取到我了。' ] ] ]