php中怎么得到sql语句运行的时间啊? php中怎么得到sql语句运行的时间啊?请大家帮忙 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 据我所知,在 php 中没有现成的函数.我给你提供个现成的类吧,其实就是上面的说的方法,只不过人家是老大,手很金贵!!!!!!<?phpclass timer { var $StartTime = 0; var $StopTime = 0; function get_microtime() { list($usec, $sec) = explode(' ', microtime()); return ((float)$usec + (float)$sec); } function start() { $this->StartTime = $this->get_microtime(); } function stop() { $this->StopTime = $this->get_microtime(); } function spent() { return round(($this->StopTime - $this->StartTime) * 1000, 1); }}$timer = new timer;$timer->start();// 查询...$timer->stop();echo $timer->spent();?> 如果你是要调试sql语句,不需要在php中引用这个速度值那么运行mysql时加 log 或 slow query log ,可以在log中查到运行时间,相信不会有比这个更准确的了 怎么我觉得opencart是用codeigniter框架来开发的 php中过滤字符串问题? php上传文件问题。。 gd库生成水印的时候,水印是透明的,但是有锯齿,怎么办? 各位请问 : 我在window 2000下已安装mysql+php了,但我不知道怎样建立一个表啊 { 救命啊 } 写php购物类的问题 为什么这个在MYSQL里面不能执行,看不出那里有错 如何得到本页面的全部URL(PHP中)? 免费空间求…… 小妹?^_^?:捉虫:为什么邮件发不出去呢? apache的端口问题 在面向对象的开发中这两中创建对象方法有什么区别?
class timer {
var $StartTime = 0;
var $StopTime = 0;
function get_microtime() {
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start() {
$this->StartTime = $this->get_microtime();
}
function stop() {
$this->StopTime = $this->get_microtime();
}
function spent() {
return round(($this->StopTime - $this->StartTime) * 1000, 1);
}
}$timer = new timer;
$timer->start();
// 查询...
$timer->stop();
echo $timer->spent();
?>
那么运行mysql时加 log 或 slow query log ,
可以在log中查到运行时间,
相信不会有比这个更准确的了