0
我有一個ZF2應用程序,我需要通過自定義數據庫查詢。我已經在local.php和global.php中設置了我的數據庫憑證。從一個類,我如何獲得一個數據庫對象?ZF2數據庫對象
這是我global.php:
return array(
'db' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=database_name;host=localhost',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter' => 'Zend\Db\Adapter\AdapterServiceFactory',
),
),
);