remote_addr 不返回 IPv4 地址 [英] remote_addr not returning IPv4 address

查看:25
本文介绍了remote_addr 不返回 IPv4 地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地主机上使用 xampp,当我使用 $_SERVER["REMOTE_ADDR"] 它返回 ::1 (也在 phpinfo()).为什么这样做?我希望它返回一个正常的 IP 地址,如 127.0.0.1.我的操作系统是 windows vista.

I am using xampp on localhost and when I use $_SERVER["REMOTE_ADDR"] it returns ::1 (also does this in phpinfo()). Why does it do this? I want it to return a normal ip address like 127.0.0.1. My operating system is windows vista.

推荐答案

::1 是一个 IPv6 地址0:0:0:0:0:0:0:1 的缩写,即 环回地址到本地机器.所以 ::1127.0.0.1 相同,只是通过 IPv6 而不是 IPv4.

::1 is an IPv6 address and an abbreviation for 0:0:0:0:0:0:0:1 that is the loopback address to the local machine. So ::1 is the same as 127.0.0.1 only via IPv6 instead of IPv4.

这篇关于remote_addr 不返回 IPv4 地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆