Home  >  Article  >  Backend Development  >  PHP method to obtain IP and URL

PHP method to obtain IP and URL

墨辰丷
墨辰丷Original
2018-05-24 11:27:032265browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn