解析PHP計算頁面執(zhí)行時間的實現(xiàn)代碼
更新時間:2013年06月18日 15:33:57 作者:
本篇文章是對PHP計算頁面執(zhí)行時間的實現(xiàn)代碼進行了詳細的分析介紹,需要的朋友參考下
如下所示:
<?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;">本次執(zhí)行時間:', microtime(TRUE) - $this->microtime, '秒</div>';
else
echo '<div style="color:#fff;background:#000;position:absolute;top:0px;right:0px;padding:3px 6px;">本次執(zhí)行時間:', microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT'], '秒</div>';
}
}
復制代碼 代碼如下:
<?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;">本次執(zhí)行時間:', microtime(TRUE) - $this->microtime, '秒</div>';
else
echo '<div style="color:#fff;background:#000;position:absolute;top:0px;right:0px;padding:3px 6px;">本次執(zhí)行時間:', microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT'], '秒</div>';
}
}
相關文章
php的GD庫imagettftext函數(shù)解決中文亂碼問題
這篇文章主要介紹了php的GD庫imagettftext函數(shù)解決中文亂碼問題,可通過將中文字符串轉為utf-8格式來解決,需要的朋友可以參考下2015-01-01
redis+php實現(xiàn)微博(二)發(fā)布與關注功能詳解
這篇文章主要介紹了redis+php實現(xiàn)微博發(fā)布與關注功能,結合實例形式分析了php結合redis實現(xiàn)微博的發(fā)布及關注相關操作技巧,需要的朋友可以參考下2019-09-09
php實現(xiàn)refresh刷新頁面批量導入數(shù)據(jù)的方法
這篇文章主要介紹了php實現(xiàn)refresh刷新頁面批量導入數(shù)據(jù)的方法,借鑒了dedecms批量生成html的原理,采用refresh代替js跳轉來實現(xiàn),非常具有實用價值,需要的朋友可以參考下2014-12-12
PHPCrawl爬蟲庫實現(xiàn)抓取酷狗歌單的方法示例
這篇文章主要介紹了PHPCrawl爬蟲庫實現(xiàn)抓取酷狗歌單的方法,涉及PHPCrawl爬蟲庫的使用及正則匹配相關操作技巧,需要的朋友可以參考下2017-12-12
PHP htmlspecialchars_decode()函數(shù)用法講解
今天小編就為大家分享一篇關于PHP htmlspecialchars_decode()函數(shù)用法講解,小編覺得內容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧2019-03-03

