时间:2021-07-01 10:21:17 帮助过:4人阅读
$t1
=microtime(true);
mysql_query(
$sql
);
echo
microtime(true)-
$t1
;
2.
//计时开始
runtime();
//执行查询
mysql_query($sql);
//计时结束.
echo runtime(1);
//计时函数
function runtime($mode=0) {
static $t;
if(!$mode) {
$t = microtime();
return;
}
$t1 = microtime();
list($m0,$s0) = split(" ",$t);
list($m1,$s1) = split(" ",$t1);
return sprintf("%.3f ms",($s1+$m1-$s0-$m0)*1000);
}
PHP获取MySQL执行sql语句的查询时间
标签: