略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: pg_trace

2024-04-28

pg_trace

(PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8)

pg_trace启动一个 PostgreSQL 连接的追踪功能

说明

pg_trace(string $pathname, string $mode = ?, resource $connection = ?): bool

pg_trace() 启动 PostgreSQL 前端/后端通讯的追踪并记录到 pathname 指定的文件中。要完全理解结果,用户需要熟悉 PostgreSQL 通讯协议的本质。对不熟悉的用户来说,追踪发送到服务器的查询错误依然有用,例如可以用 grep '^To backend' trace.log 来查看哪些查询实际上被发送到了 PostgreSQL 服务器。更多信息参考 PostgreSQL 手册。

参数 pathnamemodefopen()(mode 默认为 'w') 中的一样。connection 指定了要追踪的连接,默认为上一个打开的连接。

如果 pathname 可以作为日志文件打开,则 pg_trace() 返回 true,否则返回 false

参见 fopen()pg_untrace()

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.pg-trace.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3