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); ?>