1
lslqtz 2023-03-05 16:30:20 +08:00
```
if (!empty($_SERVER['HTTP_CF_CONNECTING_IP'])) { $clientIP = $_SERVER['HTTP_CF_CONNECTING_IP']; } else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { // Amazon CloudFront #$clientIP = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0]; // Cloudflare /* $clientIPList = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); // 临时使用, 其它代理 IP 不应纳入列表. $clientIP = $clientIPList[((count($clientIPList) > 1) ? 1 : 0)]; */ $clientIP = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR'])[0]; } else if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $clientIP = explode(',', $_SERVER['HTTP_CLIENT_IP'])[0]; } else { $clientIP = $_SERVER['REMOTE_ADDR']; } ``` 这边自己在程序里直接用的... |
2
lslqtz 2023-03-05 16:33:51 +08:00 1
你这个应该是因为 Pseudo IPv4 吧.
https://developers.cloudflare.com/support/network/understanding-and-configuring-cloudflares-ipv6-support/ 看看这个. |
4
yumusb 2023-03-05 19:30:09 +08:00 via Android
不要设置 0.0.0.0/0
|