This article mainly introduces the ZF Framework database tracker Use example, now the use of the tracker to share to everyone, need friends can refer to the following
The method to invoke the tracker code is as follows: $Profiler = $Db-> getprofiler (); Code as follows: <?php/* Tracker Use Method */ //Introduce Loader Class (Automatic loading Class) require_once ("zend/loader.php"); Use the Loader class to introduce a Db class Zend_loader::loadclass ("zend_db"); Introducing the ZEND_DB state-Zend_loader::loadclass ("Zend_db_statement_pdo"); Configure database connection Information $Config = Array (' Host ' => ' 127.0.0.1 ', ' username ' => ' root ', ' Passwo Rd ' => ', ' dbname ' => ' test ', ' Profiler ' => ' true ' ; Tells the database and database configuration information that the zend_db class operates $Db = Zend_db::factory (' Pdo_mysql ', $Config); //EXECUTE encoded statements $Db-> query ("Set Names UTF8 "); -----------------------------------------------------$SQL = "SELECT * from Gongsi"; $Db-> Query ($SQL); The method of calling the tracker $Profiler = $Db-> getprofiler (); Gets the number of Count echo "submissions for the submission statement:". $Profiler-> gettotalnumqueries (). "<br>"; Gets the information executed by the SQL statement $Result = $Profiler-> getqueryprofiles (); foreach ($Result as $key => $value) { //output runs the statement echo "text is:". $value->getquery (). "<br>"; //the time it takes for the output to run the statement echo "time spent:". $value->getelapsedsecs (). "<br>"; The total time that was spent in outputting all statements echo "The total time spent is:". $Profiler-> gettotalelapsedsecs ();?>