<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/1
 * Time: 16:56
 */
namespace app\index\controller;

use think\Config;

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);
    }
}

 

相关文章:

  • 2022-12-23
  • 2021-06-06
  • 2022-12-23
  • 2022-01-03
  • 2022-12-23
  • 2022-02-24
  • 2021-09-05
  • 2019-03-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2021-10-09
  • 2021-05-18
相关资源
相似解决方案