默认采用单例方式连接数据库
PDO options默认设置: PDO::ATTR_ERRMODE = PDO::ERRMODE_EXCEPTION, PDO::ATTR_TIMEOUT = 1
PDO dsn默认设置: charset=utf8
public object __construct(array $configs [, bool $reconnection = false])
连接数据库配置信息
连接成功返回 Object , 失败返回 NULL
<?php $configs = array( 'dsn' => array('host' => '127.0.0.1', 'dbname' => 'test', 'port' => 6666), 'username' => 'test', 'password' => 'AbcdefRDvgedf', ); $mysql = new Asf_Db_Adapter_Mysql($configs); print_r($mysql);
<?php $configs = array( 'dsn' => array('host' => '127.0.0.1', 'dbname' => 'test', 'port' => 6666), 'username' => 'test', 'password' => 'AbcdefRDvgedf', 'options' => array( PDO::ATTR_PERSISTENT => 1 ) ); $mysql = new Asf_Db_Adapter_Mysql($configs); print_r($mysql);