gpt4 book ai didi

php - PHP register_shutdown_function 1秒延迟

转载 作者:可可西里 更新时间:2023-11-01 13:47:02 25 4
gpt4 key购买 nike

我想弄清楚为什么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

最佳答案

您的问题有一个正确答案https://stackoverflow.com/a/19273025/341260

关于php - PHP register_shutdown_function 1秒延迟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20459830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com