I'm trying to get the client IP address using the code $_SERVER['REMOTE_ADDR']
.
When I tried to dd($_SERVER['REMOTE_ADDR'])
, it gives me the following output.
string '::1' (length=3)
What's the reason? Am I doing it wrong?
My target is to identify the user location based on the IP address and calling an external API.
When you have a server on say your laptop, and you try to access it from the same laptop, the website sees it as it self and is represented in many different ways, and here are a few:
127.0.0.1
::1
localhost
To see the IP of your computer you can do the following:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.