<?php
$ip = $_SERVER["REMOTE_ADDR"];
$time=date('Y-m-d H:i:s',time());
$content = "\r\n"."ip:".$ip." time:".$time;
//定义文件存放的位置
$compile_dir = "./iplog.txt";
//下面就是写入的PHP代码了
$file = fopen($compile_dir,"a+");
fwrite($file,$content);
fclose($file);
?>