Yii2 数据库表前缀使用
1. 配置
'db' => [ 'class' => 'yiidbConnection', 'dsn' => 'mysql:host=localhost;dbname=demo', 'username' => 'user', 'password' => 'pass', 'charset' => 'utf8', 'tablePrefix' => 'de_', ],
2. models中使用 %
class Test extends ActiveRecord { public static function tableName() { return '{{%table}}'; } }