请参考yii2 官网权威指南2.0
数据库访问 (DAO)
$db = new yii\db\Connection(['dsn' => 'mysql:host=localhostdbname=example',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
])
// or config in the mian-local.php
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhostdbname=example',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
],
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)