调用追踪器的方法
$Profiler = $Db -> getProfiler();
'127.0.0.1' , 'username' => 'root' , 'password' => '111' , 'dbname' => 'test', 'profiler' => "true" );//告诉Zend_Db类所操作的数据库和数据库配置信息$Db = Zend_Db::factory('PDO_Mysql' , $Config); //执行编码语句 $Db -> query("set names utf8");//-----------------------------------------------------$Sql = "select * from gongsi";$Db -> query($Sql);//调用追踪器的方法$Profiler = $Db -> getProfiler();//获取提交语句的条数echo "提交的个数:" . $Profiler -> getTotalNumQueries() . "
";//获取SQL语句执行的信息$Result = $Profiler -> getQueryProfiles();foreach ($Result as $key => $value) { //输出运行过的语句 echo "文本内容为:" . $value->getQuery() . "
"; //输出运行语句所花费的时间 echo "花费时间为:" . $value->getElapsedSecs() . "
";}//输出所有语句花费的总时间echo "花费的总时间为:" . $Profiler -> getTotalElapsedSecs();?>