Home > Backend Development > PHP Tutorial > PHP example code for obtaining the IP of the client and server_PHP tutorial

PHP example code for obtaining the IP of the client and server_PHP tutorial

WBOY
Release: 2016-07-13 17:41:57
Original
1010 people have browsed it

The example code for PHP to obtain the IP of the client and server is as follows:

  1. echo "(1) The IP address of the user browsing the current page is: ";
  2. echo $_SERVER[REMOTE_ADDR];
  3. echo "
    ";
  4. echo "(2) The IP address of the user browsing the current page is: ";
  5. echo getenv(REMOTE_ADDR);
  6. echo "
    ";
  7. echo "The IP address of the host www.ite5e.com is :";
  8. echo gethostbyname(www.baidu.com);
  9. ?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486100.htmlTechArticlePHP The example code for obtaining the IP of the client and server is as follows: ?php echo "(1) Browse the current page The user's IP address is: "; echo $_SERVER[REMOTE_ADDR]; echo "br /"; echo "(2) When browsing...
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