Home > Backend Development > PHP Tutorial > Solution to the problem that SHOW_RUN_TIME cannot display the running time properly in ThinkPHP Original, thinkphprun_PHP tutorial

Solution to the problem that SHOW_RUN_TIME cannot display the running time properly in ThinkPHP Original, thinkphprun_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-12 09:07:34
Original
1017 people have browsed it

The solution to the problem that SHOW_RUN_TIME in ThinkPHP cannot display the running time normally. Original, thinkphprun

The example in this article tells the solution to the problem that SHOW_RUN_TIME in ThinkPHP cannot display the running time properly. Share it with everyone for your reference. The details are as follows:

Set in ThinkPHP’s config.php:
Copy code The code is as follows: 'SHOW_RUN_TIME'=>true;
The running time can be output in the template, but sometimes the running time will not be displayed.

The solution to this is as follows:

Open the ThinkPHPLibThinkCoreView.class.php file,
In the protected function output($content,$display) method
Will:

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();
  return null;
}else {
  return $content;
}

Copy after login

changed to:

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();
  return null;
}else {
  return $content;
}

Copy after login

This problem is solved!

I hope this article will be helpful to everyone’s PHP programming based on the ThinkPHP framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1060098.htmlTechArticleThe solution to the problem that SHOW_RUN_TIME in ThinkPHP cannot display the running time normally. Original, thinkphprun This article tells an example of the problem that SHOW_RUN_TIME in ThinkPHP cannot display normally. Runtime workaround. ...
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
ThinkPHP Why use composer?
From 1970-01-01 08:00:00
0
0
0
thinkphp versions supported by php6
From 1970-01-01 08:00:00
0
0
0
thinkphp upload files
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template