Home >Backend Development >PHP Tutorial >PHP file record visitor IP example code_PHP tutorial

PHP file record visitor IP example code_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:40:401299browse

The php file records the visitor IP instance code. The code is very small and can be run in the PHP environment. I hope it can help those in need.

  1. $fp = fopen("log.txt","a ");
  2. fwrite($ fp,date("Y-m-d H:i:s"));
  3. fwrite($fp," ");
  4. fwrite($fp,$_SERVER[REMOTE_ADDR]);
  5. fwrite($fp," ");
  6. fwrite($fp,$_SERVER[HTTP_X_REWRITE_URL]);
  7. fwrite($fp," ");
  8. fwrite($fp,$_SERVER[HTTP_USER_AGENT]);
  9. fwrite($fp," ");
  10. fwrite($fp,$_SERVER["HTTP_REFERER"]);
  11. fwrite($fp," ");
  12. fclose($fp);
  13. ?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486190.htmlTechArticlephp file records the visitor IP example code. The code is very small and can be run in the PHP environment. I hope it can help someone. People who need it. ?php $fp = fopen("log.txt","a "); fwrite($fp,date("Y-m-d H...
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