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表前缀怎么配置的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号