ThinkPHP中SHOW_RUN_TIME不能正常显示运行时间的解决方法 原创
本文实例讲述了ThinkPHP中SHOW_RUN_TIME不能正常显示运行时间的解决方法。分享给大家供大家参考。具体如下:
在ThinkPHP的config.php中设置:
'SHOW_RUN_TIME'=>true;
可以在模板输出运行时间,但是有的时候会出现不显示运行时间的情况。
对此解决方法如下:
打开ThinkPHP\Lib\Think\Core\View.class.php文件,
在protectedfunctionoutput($content,$display)方法中
将:
if(C('HTML_CACHE_ON'))HtmlCache::writeHTMLCache($content);
if($display){
if(false!==strpos($content,'{__RUNTIME__}'))
{
$runtime=C('SHOW_RUN_TIME')?''.$this->showTime().'':'';
$content=str_replace('{__RUNTIME__}',$runtime,$content);
}
echo$content;
if(C('SHOW_PAGE_TRACE'))$this->showTrace();
returnnull;
}else{
return$content;
}
改为:
if(C('HTML_CACHE_ON'))HtmlCache::writeHTMLCache($content);
if($display){
$runtime=C('SHOW_RUN_TIME')?''.$this->showTime().'':'';
if(false!==strpos($content,'{__RUNTIME__}'))
{
$content=str_replace('{__RUNTIME__}',$runtime,$content);
}
else
$content.=$runtime;
echo$content;
if(C('SHOW_PAGE_TRACE'))$this->showTrace();
returnnull;
}else{
return$content;
}
至此问题搞定!
更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》及《ThinkPHP常用方法总结》
希望本文所述对大家基于ThinkPHP框架的php程序设计有所帮助。
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下