Home >php教程 >php手册 >用PHP为SHOPEX增加日志功能代码

用PHP为SHOPEX增加日志功能代码

WBOY
WBOYOriginal
2016-06-13 12:15:21957browse

尤其像知道哪些蜘蛛对本站进行了访问,访问的频度,页面,普通的站点统计都是无法解决的。

虽然我对PHP了解的很少,但是凭借.NET的开发经验,借助百度仍然很快的完成了,虽然简单,大家莫笑。

复制代码 代码如下:


// 插入SHOPEX首页index.php代码块中
// 查看PHP中的变量其实挺简单的
// 用一个函数 phpinfo() 足以查看
$fp = fopen("log.txt","a+");
fwrite($fp,date("Y-m-d H:i:s"));
fwrite($fp,"\t");
fwrite($fp,$_SERVER['REMOTE_ADDR']);
fwrite($fp,"\t");
fwrite($fp,$_SERVER['HTTP_X_REWRITE_URL']);
fwrite($fp,"\t");
fwrite($fp,$_SERVER['HTTP_USER_AGENT']);
fwrite($fp,"\t");
fwrite($fp,$_SERVER["HTTP_REFERER"]);
fwrite($fp,"\n");
fclose($fp);

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