ZF Framework Database Tracker Using the example _php tutorial

Source: Internet
Author: User
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 ...)

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.