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下的类如果对参数加调试信息,输的的内容和想想的不一样。但结果是对的。实在没有想明白!
最佳答案