php页面执行时间计算显示

#   php页面执行时间计算显示



<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
//开始时间
$time_start = microtime(true);
 
//循环一万次
for($i = 0 ; $i < 10000 ; $i++){
 
 
   //你可以用上,mktime() 生成一个昨天的时间
 
   //再用strtotime() 生成一个昨天的时间
 
   //对比两个函数认的效率高
 
}
 
//结整时间
$time_end = microtime(true);
//相减得到运行时间
$time = $time_end - $time_start;
echo "这个脚本执行的时间为 $time seconds\n";
?>


# xiaoxiao [ 2022-05-10 ]

# Address in this article

# http://www.s7smile.com/php/50

# s7smile.com