略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SeasLog::setRequestID

2024-05-02

SeasLog::setRequestID

(PECL seaslog >=1.0.0)

SeasLog::setRequestID设置可以由 SeasLog 用于区分请求的 request_id

说明

public static SeasLog::setRequestID(string $request_id): bool

为了区分一个独立的请求,如果没有调用函数 SeasLog::setRequestId() 进行指定,SeasLog 将会在请求初始化时,使用内置函数 `static char *get_uniqid ()` 生成一个 unique 值。

参数

request_id

String.

返回值

设置 request_id 成功返回 TRUE,失败返回 FALSE。

范例

示例 #1 SeasLog::setRequestID() example

<?php

var_dump
(SeasLog::setRequestID(time() . rand()));

?>

以上例程的输出类似于:

bool(true)

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/seaslog.setrequestid.php

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