Matthewl 发表于 2017-3-20 14:26:20

php性能测试函数

1.利用microtime()函数计算脚本执行时间
<?php
function gettime()   
{   
list($usec, $sec) = explode(" ",microtime());   
return ((float)$usec + (float)$sec);   
}
$start=gettime();
// 你的代码
$end=gettime();
$total=$end-$start;
echo $total;
?>

2.memory_get_usage()
页: [1]
查看完整版本: php性能测试函数