Home >Backend Development >PHP Tutorial >Get the client's IP address

Get the client's IP address

WBOY
WBOYOriginal
2016-07-29 09:08:30893browse

There are two ways to get the client’s IP address, getenv(“REMOTE_ADDR”) and $_SERVER[‘REMOTE_ADDR’]

If the server space is IIS, use $_SERVER[‘REMOTE_ADDR’]
If the server space is apache, use getenv("REMOTE_ADDR")

Summary:
getenv("REMOTE_ADDR") function can obtain the IP address normally under apache, but in iis, it has no effect at all, and $_SERVER['REMOTE_ADDR '] function can successfully obtain the visitor's IP address in Apache and is also effective under IIS.

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces how to obtain the client's IP address, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

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