本文整理匯總了PHP中global_common::getClientIP方法的典型用法代碼示例。如果您正苦於以下問題:PHP global_common::getClientIP方法的具體用法?PHP global_common::getClientIP怎麽用?PHP global_common::getClientIP使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類global_common
的用法示例。
在下文中一共展示了global_common::getClientIP方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: writeLogRequest
/**
* Ghi full request vao file
*
* @return int 1: thanh cong; 0: that bai
*
*/
public function writeLogRequest($type = 1)
{
// Duoc goi tu crontab nen khong co tham so can thiet va khong can ghi lai
if (empty($_SERVER['REQUEST_URI'])) {
return;
}
// Get all value of POST (neu dang thuc thi bang POST)
$postValues = '';
if ($_SERVER['REQUEST_METHOD'] != 'GET') {
foreach ($_POST as $var => $value) {
$postValues .= "&{$var}={$value}";
}
if (!empty($postValues)) {
$postValues = "({$postValues})";
}
}
// Tao noi dung de ghi file
$strContent = "[" . global_common::getDateTime() . "]\t";
$strContent .= global_common::getClientIP() . "\t";
$strContent .= session_id() . "\t";
// "CUSER_INFO" va "SES_AUTHENTICATED" ko duoc goi tu trong global_common va admin_global_common
$strContent .= ($type == 1 ? $_SESSION['CUSER_INFO']['user_id'] : $_SESSION['SES_AUTHENTICATED']['user_id']) . "\t";
$strContent .= $_SERVER['REQUEST_METHOD'] . "\t";
$strContent .= $_SERVER['REQUEST_URI'] . "{$postValues}\n";
// File name
$suffix = global_common::getTableSuffixByMonth(global_common::buildIDByMonth(1, global_common::getDateTime()));
if ($type == 1) {
$fileName = global_common::FOLDER_LOG . 'request_front_end' . $suffix . '.log';
} else {
$fileName = global_common::FOLDER_LOG . 'request_back_end' . $suffix . '.log';
}
// Ghi va tra ve ket qua
return self::writeFileAppend($fileName, $strContent);
}