zoukankan      html  css  js  c++  java
  • tp5中的config类和config助手函数

    <?php
    /**
     * Created by PhpStorm.
     * User: Administrator
     * Date: 2017/12/1
     * Time: 16:56
     */
    namespace appindexcontroller;
    
    use thinkConfig;
    
    class Index
    {
        public function index()
        {
            //获取config的值
            /*$res = Config::get('app_namespace');*/
            $res = config('app_namespace');//助手函数方式
            dump($res);
    
            //设置config的值
            //Config::set('username','John~~~');
            config('username','John~~');//助手函数方式
            dump(Config::get('username'));
    
            //作用域
            //Config::set('username','John','index');
            config('username','John','index');//助手函数方式
            dump(Config::get('username','index'));
    
            //检车是否有此配置
            config('username','John');//先设置,后判断
            //$res = Config::has('username');
            $res = config('?username');//助手函数方式
            dump($res);
        }
    }
  • 相关阅读:
    指针细说
    C++编码规范101
    关于C标准
    Bjarne Stroustrup语录2
    Bjarne Stroustrup 语录1
    计算机网络基础识别
    ssh
    matplotlib画图
    数据分析之Numpy
    数据分析
  • 原文地址:https://www.cnblogs.com/wangjiayi/p/7986147.html
Copyright © 2011-2022 走看看