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

PHP取得用户真实IP

WBOY
WBOYOriginal
2016-06-06 19:52:361478browse

欢迎进入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

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
Previous article:php.ini 中的shortNext article:php连接hive各种问题记录