Home > php教程 > php手册 > PHP取得用户真实IP

PHP取得用户真实IP

WBOY
Release: 2016-06-06 19:52:36
Original
1508 people have browsed it

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 function getIp() { if($_SERVER['HTTP_CLIENT_IP']) { $ip = $_SERVER['HTTP_CLIENT_IP']; } elseif ($_SERVER['HTTP_X_FORWARDED_FOR']) { $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $ip

欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入

  function getIp() {

  if($_SERVER['HTTP_CLIENT_IP']) {

  $ip = $_SERVER['HTTP_CLIENT_IP'];

  } elseif ($_SERVER['HTTP_X_FORWARDED_FOR']) {

  $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];

  } else {

  $ip = $_SERVER['REMOTE_ADDR'];

  }

  }

PHP取得用户真实IP

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template