服务器如何知道IP地址? [英] How the server knows the IP address?
本文介绍了服务器如何知道IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在网页编程中,使用服务器变量 REMOTE_ADDR
,您可以获取IP地址用户。例如在PHP中:
Hi,
In web programming, with the server variable REMOTE_ADDR
, you can get the IP address of the user. For example in PHP:
<?php
echo $_SERVER['REMOTE_ADDR'];
?>
页面上的输出是用户的IP地址。
但服务器如何知道用户的IP地址?
提前谢谢。
The output on the page is the IP address of the user.
But how the server knows the IP address of the user?
Thanks in advance.
推荐答案
_SERVER [' REMOTE_ADDR'];
?>
_SERVER['REMOTE_ADDR']; ?>
页面上的输出是用户的IP地址。
但服务器如何知道用户的IP地址?
提前谢谢。
The output on the page is the IP address of the user.
But how the server knows the IP address of the user?
Thanks in advance.
建立连接时,始终会将有关用户的某些信息传递给Web服务器。 IP地址就是其中之一。
除非您在局域网中,它通常是访问公共网站时显示的路由器的IP地址。 />
希望有所帮助。
干杯
Certain information about the user is always passed to the webserver when a connection is established. IP Address is one of them.
unless you are in a LAN, its usually the ip-address of the router that gets displayed when visiting public web sites.
hope that helps.
Cheers
>
这篇关于服务器如何知道IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文