简体   繁体   中英

How to find ip address in codeigniter?

I am using a following function to track the user's ip address. I run the application on localhost.

    $this->input->ip_address();

when I try to execute this function on my computer's localhost it returns ::1 and same thing I tryied on another computer it returns same ip address. my confusion is why it not showing the diffrent ip address for that two diffrent computers.

::1 is the loopback address in IPv6. Which is same as 127.0.0.1. That is localhost .

The code is correct. Which return the ip address. You can see different IP when running this code on server.

$ip = $this->input->ip_address();

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM