在页面顶部显示microtime的时间

时间:2012-10-30 23:56:45

标签: php

我正在使用microtime来获取脚本执行时间

$time_start = microtime(true);
....
....
//many process here, many result be printed here
$time_end = microtime(true);
$time = substr(($time_end - $time_start),0,5);
echo time;

是否可以在结果页面的上方打印$time?我也试过使用css,也打印在上面,但是,$time仍然打印在结果页面的底部。

1 个答案:

答案 0 :(得分:0)

//many process here, many result be printed here
$time_end = microtime(true);
$time = substr(($time_end - $time_start),0,5);
?>
<div class="time">
    <?php echo time; ?>
</div>

<style>
.time{
    position:absolute;
    top:0;
    right:0;
    z-index:9999;
}
</style>

您是否尝试过如此回应它到dom?