超级新人问个弱弱的问题 关于TP5.1 Config::get 望请解答

浏览:1689 发布日期:2018/07/30 分类:求助交流 关键字: TP5.1 Config
在控制器中:public function getConfig()
{
        dump(Config::get('app.default_return_type'));
        echo '<hr/>';
}
在 think\Config.php 中增加测试代码:public function get($name = null, $default = null)
    {
        // 无参数时获取所有
        if (empty($name)) {
            return $this->config;
        }

        dump($name);
        echo '<hr />';
        
……

结果输出一大堆,而不是我给的参数 app.default_return_type 。如下:
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.app_trace' (length=13)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.class_suffix' (length=16)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.app_debug' (length=13)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.exception_handle' (length=20)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.root_namespace' (length=18)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.default_timezone' (length=20)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.default_lang' (length=16)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.lang_switch_on' (length=18)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.auto_bind_module' (length=20)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'request_cache' (length=13)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'request_cache_expire' (length=20)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'request_cache_except' (length=20)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'app.default_return_type' (length=23)
D:\myphp_www\PHPTutorial\WWW\tp51\thinkphp\library\think\Debug.php:226:string 'html' (length=4)
但最后结果确实是对的。为什么?

后来发现很多think下的类如果对参数加调试信息,输的的内容和想想的不一样。但结果是对的。实在没有想明白!


最佳答案
评论() 相关
后面还有条评论,点击查看>>