CodeIgniter 用户指南 版本 1.6.3

编辑文档、查看近期更改请 登录注册  找回密码
查看原文

Table Data

These functions let you fetch table information.


这些函数可以取得表格信息

$this->db->list_tables();

Returns an array containing the names of all the tables in the database you are currently connected to. Example:


返回一个正在连接的数据库中所有表名称的数组。例如: $tables = $this->db->list_tables();

foreach ($tables as $table)
{
   echo $table;
}

$this->db->table_exists();

Sometimes it's helpful to know whether a particular table exists before running an operation on it. Returns a boolean TRUE/FALSE. Usage example:


。当想了解系统运行前某个表格是否存在时就变得非常有用。返回一个布尔值:TRUE/FALSE。例子: if ($this->db->table_exists('table_name'))
{
   // some code...
}

Note: Replace table_name with the name of the table you are looking for.


备注:替换 table_name 为你所查找的表格名称。

 

翻译贡献者: analyzer, Hex
最后修改: 2008-02-22 10:22:58