如何在PHP中获取MySQL表结构?加上所有表格的清单?

问题描述:

我需要在PHP中运行什么查询才能获取数据库中给定表的结构?我需要运行什么查询才能获得所有表的列表?

What query do I need to run in PHP to get the structure of a given table in the database? And what query do I need to run to get a list of all the tables?

要获取表的列列表,请使用DESCRIBE SQL语句.语法如下:

To get a list of columns for a table, use the DESCRIBE SQL statement. The syntax is as follows:

DESCRIBE TableName

要获取数据库上的表列表,请使用以下SQL语句:

To get a list of tables on the database, use this SQL statement:

SHOW TABLES