/** * 获取Web Db connection * @return CPdo */ public static function getWebDbConnection() { if (self::$_dbConnectionWeb === null) { $db = new CPdo(); $db->setDsn(DB_WEB_DSN); $db->setUserName(DB_WEB_USERNAME); $db->setPassword(DB_WEB_PASSWORD); $db->setChargset(DB_WEB_CHARGSET); $db->connect(); self::$_dbConnectionWeb = $db; } return self::$_dbConnectionWeb; }
<?php require "cpdo.class.php"; $pdo = new CPdo(); //通过sql语句获得值 $sql = "select * from `dede_feedback` where `id` < 20"; $res = $pdo->getValueBySelfCreateSql($sql); echo '<pre>'; var_dump($res);