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

PHP method to obtain IP and URL

墨辰丷
Release: 2023-03-27 19:06:02
Original
2356 people have browsed it

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template