array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.pg-field-type.php', 1 => 'pg_field_type', ), 'up' => array ( 0 => 'ref.pgsql.php', 1 => 'PostgreSQL 函数', ), 'prev' => array ( 0 => 'function.pg-field-type-oid.php', 1 => 'pg_field_type_oid', ), 'next' => array ( 0 => 'function.pg-flush.php', 1 => 'pg_flush', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/pgsql/functions/pg-field-type.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)
pg_field_type — 返回相应字段编号的类型名称
pg_field_type() 返回字符串,其中包含指定 result
实例中指定 field
的基本类型名称。
注意:
如果字段使用 PostgreSQL domain(而不是基本类型),则返回的是 domain 的底层类型名称,而不是 domain 本身的名称。
注意:
本函数以前的名字为 pg_fieldtype()。
包含字段类型的基本名称的 string。
版本 | 说明 |
---|---|
8.1.0 |
现在 result 参数接受 PgSql\Result
实例,之前接受 resource。
|
示例 #1 获取字段信息
<?php
$dbconn = pg_connect("dbname=publisher") or die("Could not connect");
// 假设 'title' 是 varchar 类型
$res = pg_query($dbconn, "select title from authors where author = 'Orwell'");
echo "Title field type: ", pg_field_type($res, 0);
?>
以上示例会输出:
Title field type: varchar