Closed xiaoqiu1600604528 closed 1 week ago
升级到最新版本了吗~
最新版本是支持CF的: 参考 ./application/common.php
function mac_get_client_ip()
{
static $final;
if (!is_null($final)) {
return $final;
}
$ips = [];
if (!empty($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$ips[] = $_SERVER['HTTP_CF_CONNECTING_IP'];
}
if (!empty($_SERVER['HTTP_ALI_CDN_REAL_IP'])) {
$ips[] = $_SERVER['HTTP_ALI_CDN_REAL_IP'];
}
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
$ips[] = $_SERVER['HTTP_CLIENT_IP'];
}
if (!empty($_SERVER['HTTP_PROXY_USER'])) {
$ips[] = $_SERVER['HTTP_PROXY_USER'];
}
$real_ip = getenv('HTTP_X_REAL_IP');
if (!empty($real_ip)) {
$ips[] = $real_ip;
}
if (!empty($_SERVER['REMOTE_ADDR'])) {
$ips[] = $_SERVER['REMOTE_ADDR'];
}
// 选第一个最合法的,或最后一个正常的IP
foreach ($ips as $ip) {
$verifyResult = filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE);
if (!$verifyResult){
continue;
}
$verifyResult && $final = $ip;
}
empty($final) && $final = '0.0.0.0';
return $final;
}
在套完conflare的cdn后,用户在登录注册ip在后台看到的为cdn的IP,请问官方该怎么办