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