codecamp

如何使用?

使用介绍

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

在目录结构文档页,可以看到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=>'你获取到我了。' ] ] ]

middleware 配置说明
queue 队列配置
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

应用

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }