ThinkPHP SHOW_RUN_TIME does not display the running time properly. the solution is original, thinkphprun. In ThinkPHP, the solution of SHOW_RUN_TIME cannot display the running time normally is original. thinkphprun this article describes how to display the running time normally in ThinkPHP SHOW_RUN_TIME. In ThinkPHP, SHOW_RUN_TIME cannot display the running time properly. Solution: Original, thinkphprun
The example in this article describes how SHOW_RUN_TIME in ThinkPHP cannot display the running time properly. Share it with you for your reference. The details are as follows:
Set in config. php of ThinkPHP:
The code is as follows: 'show _ RUN_TIME '=> true;
You can output the running time in the template, but sometimes the running time is not displayed.
The solution is as follows:
Open the ThinkPHP \ Lib \ Think \ Core \ View. class. php file,
In the protected function output ($ content, $ display) method
Set:
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;}
Changed:
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;}
Now the problem is solved!
I hope this article will help you design php programs based on the ThinkPHP framework.
Original Author, thinkphprun this article describes how to solve the problem that SHOW_RUN_TIME in ThinkPHP cannot display the running time properly ....