我正在试图找出为什么PHP需要1秒才能执行register_shutdown_function
。如果有办法克服这一点。
<?php
$start_time = microtime(true);
function shutdown($start_time)
{
$time_diff = round(1000 * (microtime(true)-$start_time));
echo $time_diff . "ms<br/>";
}
register_shutdown_function('shutdown', $start_time);
register_shutdown_function('shutdown', $start_time);
register_shutdown_function('shutdown', $start_time);
register_shutdown_function('shutdown', $start_time);
register_shutdown_function('shutdown', $start_time);
输出:
1001ms
2001ms
3003ms
4003ms
5003ms
在Windows / PHP上运行XAMPP 1.6.8:5.2.6
答案 0 :(得分:1)
There is a correct answer to your question https://stackoverflow.com/a/19273025/341260