PDO 封装类
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PDO 封装类相关的知识,希望对你有一定的参考价值。
<?php
/**
* PDO mysql 简单封装
* @author Kl_PENG QQ群:207776690
*/
class PdoHelper {
//单例模式
private static $_instance;
const DB_HOST = ‘localhost‘;
const DB_PORT = ‘3306‘;
const DB_NAME = ‘test‘;
const DB_USER = ‘root‘;
const DB_PASS = ‘‘;
const DB_CHARSET = ‘utf8‘;
protected $_sql = ‘‘;
//构造函数
private function __construct() {
$this->dsn = ‘mysql:host=‘ . self::DB_HOST . ‘;port=‘ . self::DB_PORT . ‘;dbname=‘ . self::DB_NAME;
$this->dbuser = self::DB_USER;
$this->dbpass = self