一个可以统计你程序的运行时间长知的php类,有需要的朋友可参考一下。
快捷网上订餐系统是一款基于互联网与移动互联网订餐服务预订系统,目前系统主要定位于细分餐饮市场,跟随互联网潮流抓住用户消费入口新趋势,真正将 商家 与用户连接起来,让商家为用户提供优质服务与消费体验。 快捷网上订餐系统中的快字不仅体现在程序运行的速度上快,更在用户操作体验上让用户更好更快的找到自己需要,完成预定,为用户节省时间,是的我们只是一款服务软件,已经告别了从前整个网站充满了对用户没有价值的
476
| 代码如下 | 复制代码 |
| class Timer { private $StartTime = 0;//程序运行开始时间 private $StopTime = 0;//程序运行结束时间 private $TimeSpent = 0;//程序运行花费时间 function start(){//程序运行开始 $this->StartTime = microtime(); } function stop(){//程序运行结束 $this->StopTime = microtime(); } function spent(){//程序运行花费的时间 if ($this->TimeSpent) { return $this->TimeSpent; } else { list($StartMicro, $StartSecond) = explode(" ", $this->StartTime); list($StopMicro, $StopSecond) = explode(" ", $this->StopTime); $start = doubleval($StartMicro) + $StartSecond; $stop = doubleval($StopMicro) + $StopSecond; $this->TimeSpent = $stop - $start; return substr($this->TimeSpent,0,8)."秒";//返回获取到的程序运行时间差 } } } $timer = new Timer(); $timer->start(); //...程序运行的代码 $timer->stop(); echo "程序运行时间为:".$timer->spent(); |
|
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号