我有自编的CMS,它不会返回正确的用户IP地址,如下所示:
define("USER_IP", $_SERVER['HTTP_X_FORWARDED_FOR']);
它给了我以下通知:
Notice: Undefined index: HTTP_X_FORWARDED_FOR in /var/www/p00000/data/www/domain.ru/core/maincore.php on line 30
和第20行=到行定义(" USER_IP" ...
一些问题:
感谢您的帮助!
答案 0 :(得分:0)
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
define("USER_IP", $_SERVER['HTTP_X_FORWARDED_FOR']);
} else {
define("USER_IP", $_SERVER['REMOTE_ADDR']);
...