• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • SeasLog::setRequestID()

    (PECL seaslog >=1.0.0)

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

    说明

    publicstaticSeasLog::setRequestID(string $request_id): bool

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

    参数

    $request_id

    String.

    返回值

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

    范例

    Example #1 SeasLog::setRequestID() example

    <?php
    var_dump(SeasLog::setRequestID(time() . rand()));
    ?>
    

    以上例程的输出类似于:

    bool(true)
    

    参见

    • SeasLog::getRequestID() 获得当前 SeasLog 中用于区分请求的 request_id