yii表前缀的配置方法:首先对component中db的配置进行修改;然后在相应的model中修改tablename属性,修改语句如“public function tableName(){return '{{}';}”。
yii2配置表前缀
前缀设置
component中db的配置修改
'db'=>array( 'connectionString' => 'mysql:host=localhost;dbname=xxxx', 'emulatePrepare' => true, 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'tablePrefix' => 'tb_', //加入前缀名称fc_ ),
推荐:《yii教程》
然后在相应的model中修改tablename属性如下:
例如model 的 User中
修改为:
public function tableName() { return '{{}'; }
更多关于云服务器,域名注册,虚拟主机的问题,请访问西部数码官网:www.west.cn