好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

通过PHP程序来 计算页面执行时间

我们先通过中国网格(  HdhCmsTestcnwg.cn  )开通一个 PHP空间 ,然后自己写了个计算页面执行时间的脚本

  执行时间会显示在页面右上角

  优点是只要在开始的时候执行一下就可以了

  代码片段(1)[代码] [PHP]代码

  01

  02 $t = new executeTime;

  03

  04 phpinfo();

  05

  06 class executeTime{

  07 private $microtime;

  08 public function __construct(){

  09 $this->microtime = microtime(true);

  10 }

  11

  12 public function getNow(){

  13 $this->__dectruct();

  14 }

  15

  16 public function __destruct(){

  17 if (empty($_SERVER['REQUEST_TIME_FLOAT']))

  18 echo '

';

 

  19 else

  20 echo '

';

 

  21 }

  22 }

 

查看更多关于通过PHP程序来 计算页面执行时间的详细内容...

  阅读:44次