Home > Article > Backend Development > PHP method to obtain IP and URL
This article mainly introduces the method of obtaining IP and URL in PHP. Interested friends can refer to it. I hope it will be helpful to everyone.
is as follows:
echo 'http://'.$_SERVER['HTTP_HOST'];输出您访问网址的域名 echo $benji_ip=gethostbyname($_ENV['COMPUTERNAME']);输出服务器的ip $fangwen_ip=$_SERVER["REMOTE_ADDR"]; 输出访问者的外网ip
The above is the entire content of this article, I hope it will be helpful to Everyone’s learning helps.
Related recommendations:
Debugging SOAP error message under php5.5.12
PHPHTMLPurifier prevents XSS attacks
PHP achieves unlimited classification in
The above is the detailed content of PHP method to obtain IP and URL. For more information, please follow other related articles on the PHP Chinese website!