# PHP 函数:pg\_pConnect()

**URL:** <https://www.isharkfly.com/t/php-pg-pconnect/4932>\
**Category:** PHP\
**Created:** [October 27, 2012, 3:25am UTC](https://www.isharkfly.com/t/php-pg-pconnect/4932 "2012-10-27T03:25:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [October 27, 2012, 3:25am UTC](https://www.isharkfly.com/t/php-pg-pconnect/4932/1 "2012-10-27T03:25:08Z")

</div>

打开 PostgreSQL 服务器持续连接。

语法: int pg\_pconnect(string [host], string [port], string [options], string [tty], string database);

返回值: 整数

函数种类: 数据库功能

内容说明  
本函数打开与 PostgreSQL 服务器的持续连接。参数 host 表服务器名称。参数 port 为连接埠。参数 options 为选项。参数 tty 为终端机。参数 database 为数据库名。成功返回连接代号、失败返回 false 值。本函数和 pg\_Connect() 不同的地方在于使用本函数打开数据库时，程序会先寻找是否曾经执行过本函数，若执行过则返回先前执行的 ID。此外程序结束后并不会关闭连接，而是等下次程序使用。
