Home  >  Article  >  Backend Development  >  Use PHP to add logging function code to SHOPEX_PHP tutorial

Use PHP to add logging function code to SHOPEX_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:36:26921browse

Especially knowing which spiders have visited this site, the frequency of visits, pages, and ordinary site statistics cannot be solved.

Although I know very little about PHP, with the development experience of .NET and the help of Baidu, I still completed it quickly. Although it is simple, don’t laugh.

Copy the code The code is as follows:

// Insert into the index.php code block on the SHOPEX homepage
/ / Checking variables in PHP is actually quite simple
// Using a function phpinfo() is enough to check
$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);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322111.htmlTechArticleEspecially like knowing which spiders have visited this site, the frequency of visits, pages, and general site statistics. It cannot be solved. Although I know very little about PHP, with the development of .NET...
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