Method of invoking the tracker
Copy CodeThe code is as follows:
$Profiler = $Db-Getprofiler ();
Copy the Code code as follows:
/*
How to use the tracker
*/
Introducing the loader class (auto-load Class)
Require_once ("zend/loader.php");
Introducing a DB class using the Loader class
Zend_loader::loadclass ("zend_db");
Introducing the ZEND_DB State device
Zend_loader::loadclass ("Zend_db_statement_pdo");
Configure Database connection Information
$Config = Array (' host ' = ' 127.0.0.1 ',
' Username ' = ' root ',
' Password ' = ' 111 ',
' dbname ' = ' test ',
' Profiler ' = ' true '
);
Tells the zend_db class what database and database configuration information to manipulate
$Db = zend_db::factory (' Pdo_mysql ', $Config);
Executing an encoded statement
$Db, Query ("Set names UTF8");
//-----------------------------------------------------
$SQL = "SELECT * from Gongsi";
$Db, query ($SQL);
Method of invoking the tracker
$Profiler = $Db-Getprofiler ();
Gets the number of bars for the commit statement
echo "Number of commits:". $Profiler, Gettotalnumqueries (). "
";
Get information on SQL statement execution
$Result = $Profiler-Getqueryprofiles ();
foreach ($Result as $key = $value)
{
Output statements that have been run
echo "Text content is:". $value->getquery (). "
";
The time it takes to output a run statement
echo "Takes time:". $value->getelapsedsecs (). "
";
}
Total time spent in outputting all statements
echo "Total time spent is:". $Profiler-Gettotalelapsedsecs ();
?>
http://www.bkjia.com/PHPjc/741261.html www.bkjia.com true http://www.bkjia.com/PHPjc/741261.html techarticle the method of calling the tracker copies the code as follows: $Profiler = $Db-getprofiler (); The copy code code is as follows:? How to use the PHP/* Tracker *//introduce the loader class (Auto Load Class ...)