如何獲取yii中的所有表名?獲取yii中的所有表名
mySQL中的sql查詢是SHOW TABLES
。 我想:
$sql = 'SHOW TABLES';
$tables = Yii::app()->db
->createCommand($sql)
->queryAll();
print_r($tables);
它拋出一個錯誤:
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