yii2配置表前缀


前缀设置

component中db的配置修改

'db'=>array(
'connectionString' => 'mysql:host=localhost;dbname=xxxx',
'emulatePrepare' => true,
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'tablePrefix' => 'tb_',   //加入前缀名称fc_
),
 
然后在相应的model中修改tablename属性如下:
例如model   的  User中
修改为:
public function tableName()
{
return '{{%user}}';
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM