有人能帮我读出IPv6吗?
我试过这个链接中的方法,但它对我不起作用。
IPv4是没有问题的:
echo $_SERVER['REMOTE_ADDR'];
但是IPv6却不知道为什么无法读出......
这个网站两者(IPv4 and IPv6)都可以:http://ipv6-test.com/api/,但我试过的结果却一个都没有。
You have the right idea, but the request has to be made with IPv6 if you want an IPv6 address.
The site you link to probably works by having a page that loads resource from a server only accessible via IPv6. If it works, then you know the address.
I would just build a site that fires off AJAX requests to the same server, one via IPv4 and one via IPv6. Use its IP addresses to rule out any local DNS issues where IPv6 may not be supported.