具体如下:
在ThinkPHP的config.php中设置:
'SHOW_RUN_TIME'=>true;
可以在模板输出运行时间,但是有的时候会出现不显示运行时间的情况。
对此解决方法如下:
打开 ThinkPHPLibThinkCoreView.class.php文件,
在protected function output($content,$display)方法中
将:
if(C('HTML_CACHE_ON')) HtmlCache::writeHTMLCache($content);
if($display) {
if(false !== strpos($content,''))
{
$runtime = C('SHOW_RUN_TIME')? ''.$this->showTime().'' : '';
$content = str_replace('', $runtime, $content);
}
echo $content;
if(C('SHOW_PAGE_TRACE')) $this->showTrace();
return null;
}else {
return $content;
}改为:
if(C('HTML_CACHE_ON')) HtmlCache::writeHTMLCache($content);
if($display) {
$runtime = C('SHOW_RUN_TIME')? ''.$this->showTime().'' : '';
if(false !== strpos($content,''))
{
$content = str_replace('', $runtime, $content);
}
else
$content .= $runtime;
echo $content;
if(C('SHOW_PAGE_TRACE')) $this->showTrace();
return null;
}else {
return $content;
}| 欢迎光临 一起源码网 (https://www.171739.xyz/) | Powered by Discuz! X3.3 |