您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

yii表前缀怎么配置

2024/4/29 10:05:26发布12次查看
yii表前缀的配置方法:首先对component中db的配置进行修改;然后在相应的model中修改tablename属性,修改语句如“public function tablename(){return '{{%user}}';}”。
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 '{{%user}}';}
以上就是yii表前缀怎么配置的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product