脚本运行了多长时间?
如何检查我的exec()
脚本已经运行了多长时间?输出会是这样的:脚本运行了多长时间?
1 Day(s) 2 hours 23 minutes 12 seconds
我不希望它输出的更多然后在60秒这样的
1 Day(s) 2 hours 23 minutes 118 seconds
我的代码:
$start = time();
$s = time() - $start;
$m = floor($s/60);
$h = floor($m/60);
$msg = "script running for approx: Seconds - $s | Minutes - $m | Hours - $h";
echo $msg;
用/
将秒数除以60即可得到确切的分钟数,然后将分钟数加到分钟中与%
Ë秒部分,你将获得剩余的第二,这是不到60
编辑
即使你可能有问题,您分钟为好。更改过
$start = time();
$s = time() - $start;
$m = floor($s/60);
$h = floor($m/60);
$mins = ($m % 60);
$seconds = ($s % 60);
$msg = "script running for approx: Seconds - $seconds | Minutes - $mins | Hours - $h";
echo $msg;
呵呵?这是什么代码? – user1691356
你目前的代码是什么? – Rab
这里是我的脚本http://pastebin.com/13gZdbA6 – user1691356
如果使用PHP 5.4,这是给人的时间在PHP
$runtime = round(microtime(TRUE) - $_SERVER['REQUEST_TIME_FLOAT'], 6);
echo "Script running for $runtime seconds";
http://pastebin.com/13gZdbA6花 – user1691356
你永远不会调用'高管的具体金额()'在你的脚本中。 – Barmar