• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • pg_get_pid()

    (PHP 4 >= 4.3.0, PHP 5, PHP 7)

    Ping 数据库连接

    说明

    pg_get_pid(resource $connection): int

    pg_get_pid()取得后端(数据库服务器进程)的 PID。PID 用来检查其它进程是否发送了NOTIFY消息。

    Example #1 PostgreSQL 后端 PID

    <?php 
    $conn = pg_pconnect("dbname=publisher");
    if (!$conn) {
        echo "An error occured.\n";
        exit;
    }
    // Backend process PID. Use PID with pg_get_notify()
    $pid = pg_get_pid($conn);
    ?>
    

    参见pg_get_notify()。

    上篇:pg_get_notify()

    下篇:pg_get_result()