PHP 計算頁面執行時間
<?php $t = new executeTime;phpinfo();
class executeTime{ private $microtime; public function __construct(){ $this->microtime = microtime(true); }
public function getNow(){ $this->__dectruct(); } public function __destruct(){ if (empty($_SERVER['REQUEST_TIME_FLOAT'])) echo '<div style="color:#fff;background:#000;position:absolute;top:0px;right:0px;padding:3px 6px;">本次執行時間:', microtime(TRUE) - $this->microtime, '秒</div>'; else echo '<div style="color:#fff;background:#000;position:absolute;top:0px;right:0px;padding:3px 6px;">本次執行時間:', microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT'], '秒</div>'; }
}</pre>
本文由用戶 xm52 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!