Home > php教程 > php手册 > PHP 文件记录访问者IP实例代码

PHP 文件记录访问者IP实例代码

WBOY
Release: 2016-06-13 10:39:31
Original
1735 people have browsed it

php 文件记录访问者IP实例代码 ,代码很少,在PHP环境里可以运行,希望可以帮助有需要的人。

  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. ?>

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