(PHP 4 >= 4.3.0, PHP 5, PHP 7)
pg_get_notify — Ping 锟斤拷锟捷匡拷锟斤拷锟斤拷
$connection
[, int $result_type
] ) : array
pg_get_notify() 取锟斤拷 SQL 锟斤拷锟斤拷
NOTIFY
锟斤拷锟酵碉拷通锟斤拷锟斤拷息锟斤拷要锟斤拷锟斤拷通锟斤拷锟斤拷息锟斤拷锟斤拷锟诫发锟斤拷 SQL 锟斤拷锟斤拷
LISTEN锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟酵拷锟斤拷锟较拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷息锟斤拷锟斤拷锟揭凤拷锟截猴拷说锟�
PID锟斤拷锟斤拷锟矫伙拷锟斤拷锟较拷蚍祷锟� FALSE
锟斤拷
锟轿硷拷 pg_get_pid()锟斤拷
Example #1 PostgreSQL NOTIFY 锟斤拷息
<?php
$conn = pg_pconnect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
}
// Listen 'author_updated' message from other processes
pq_query($conn, 'LISTEN author_updated;');
$notify = pg_get_notify($conn);
if (!$notify)
print("No messages\n");
else
print_r($notify);
?>