yii表前綴的配置方法:首先對component中db的配置進(jìn)行修改;然后在相應(yīng)的model中修改tablename屬性,修改語句如“public function tablename(){return '{{}';}”。
yii2配置表前綴
前綴設(shè)置
component中db的配置修改
'db'=>array('connectionstring' => 'mysql:host=localhost;dbname=xxxx','emulateprepare' => true,'username' => 'root','password' => '','charset' => 'utf8','tableprefix' => 'tb_', //加入前綴名稱fc_), 推薦:《yii教程》
然后在相應(yīng)的model中修改tablename屬性如下:
例如model 的 user中
修改為:
public function tablename(){return '{{}';}