如何获取yii中的所有表名?
mySQL中的sql查询是SHOW TABLES.我试过了:
$sql = 'SHOW TABLES';
$tables = Yii::app()->db
->createCommand($sql)
->queryAll();
print_r($tables);
Run Code Online (Sandbox Code Playgroud)
它抛出一个错误:
CDbCommand failed to execute the SQL statement:
CDbCommand failed to prepare the SQL statement:
SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error.
The SQL statement executed was: SHOW TABLES
Run Code Online (Sandbox Code Playgroud)