PDO Singleton Model

Source: Internet
Author: User

Introduction: This is a detailed page of the PDO Singleton model. It introduces the knowledge, skills, and experience related to PhP, PHP, MySQL, PDO, and Singleton PDO Singleton models, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 344671 'rolling = 'no'>

<? PHP/*** ipdo. PHP ** discription ** @ filename ipdo. PHP * @ version V1.0 * @ update 2011-4-27 * @ author Randy. hong * @ Contact homingway@163.com * @ package PDO * // dB configdefine ('db _ host', 'localhost'); define ('db _ port', '123 '); define ('db _ user', 'root'); define ('db _ passwd', '000000'); define ('db _ charset', 'utf8 '); class ipdo {/*** the singleton instance */static public $ pdoinstance;/*** creates PDO instance representing a connection to a database and makes the instance available as a singleton * @ return PDO */public function _ construct () {$ DSN = 'mysql: host = '. db_host. '; Port = '. db_port. '; dbname = '. db_name; $ driver_options = array (PDO: mysql_attr_init_command => "set names ". db_charset); If (! Self ::$ pdoinstance) {try {self ::$ pdoinstance = new PDO ($ DSN, db_user, db_passwd, $ driver_options); self :$ pdoinstance-> setattribute (PDO:: attr_errmode, PDO: errmode_exception);} catch (pdoexception $ e) {die ($ e-> getmessage ();} return self: $ pdoinstance ;}} // use $ PDO = new ipdo ();?>

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/344671.html pageno: 4.

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.