PHP 文件记录访问者IP实例代码_PHP教程
程序员文章站
2022-03-05 12:51:17
...
php 文件记录访问者IP实例代码 ,代码很少,在PHP环境里可以运行,希望可以帮助有需要的人。
- $fp = fopen("log.txt","a ");
- fwrite($fp,date("Y-m-d H:i:s"));
- fwrite($fp," ");
- fwrite($fp,$_SERVER[REMOTE_ADDR]);
- fwrite($fp," ");
- fwrite($fp,$_SERVER[HTTP_X_REWRITE_URL]);
- fwrite($fp," ");
- fwrite($fp,$_SERVER[HTTP_USER_AGENT]);
- fwrite($fp," ");
- fwrite($fp,$_SERVER["HTTP_REFERER"]);
- fwrite($fp," ");
- fclose($fp);
- ?>