說明
array
pg_get_notify ( resource connection [, int result_type] )
pg_get_notify() 取得 SQL 指令
NOTIFY
傳送的通告訊息。要接收通告訊息,必須發送 SQL 指令
LISTEN。若果連線中有通告訊息,則陣列包括訊息名並且返回後端的
PID。若果沒有訊息則返回 FALSE。
參見 pg_get_pid()。
例子 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); ?>
|
|