[英]How to find ip address in codeigniter?
I am using a following function to track the user's ip address. 我正在使用以下功能来跟踪用户的IP地址。 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. 当我尝试在计算机的本地主机上执行此功能时,它将返回:: 1,而我在另一台计算机上尝试过的相同内容将返回相同的IP地址。 my confusion is why it not showing the diffrent ip address for that two diffrent computers. 我的困惑是为什么它不显示那两个不同计算机的不同IP地址。
::1
is the loopback address in IPv6. ::1
是IPv6中的环回地址。 Which is same as 127.0.0.1.
与127.0.0.1.
相同127.0.0.1.
That is localhost
. 那是localhost
。
The code is correct. 代码正确。 Which return the ip address. 哪个返回IP地址。 You can see different IP when running this code on server. 在服务器上运行此代码时,您可以看到不同的IP。
$ip = $this->input->ip_address();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.