2024 年日本 PHP 研討會

SeasLog::getRequestID

(PECL seaslog >=1.0.0)

SeasLog::getRequestID取得 SeasLog request_id 區分請求

說明

public static SeasLog::getRequestID(): 字串

為了區分單個請求,例如未呼叫 SeasLog::setRequestId() 函式,在請求初始化時會使用內建 `static char *get_uniqid ()` 函式產生的唯一值。

參數

此函式沒有參數。

回傳值

回傳由內建 `static char *get_uniqid ()` 函式產生的字串,或由 SeasLog::setRequestId() 函式設定的值。

範例

範例 #1 SeasLog::getRequestID() 範例

<?php

var_dump
(SeasLog::getRequestID());
var_dump(SeasLog::setRequestID('reqeust_id_test_'.time()));
var_dump(SeasLog::getRequestID());

?>

上述範例將輸出類似以下的內容:

string(13) "5b3f21a209519"
bool(true)
string(26) "reqeust_id_test_1530864034"

另請參閱

新增註記

使用者貢獻的註記

此頁面沒有使用者貢獻的註記。
To Top