Home > Article > Backend Development > shopex official website Use PHP to add log function code to SHOPEX
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, I still completed it quickly with the help of Baidu. 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
// Viewing variables in PHP is actually quite simple
// Using a function phpinfo() is enough to view
$ 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);
The above introduces the shopex official website and uses PHP to add log function code to SHOPEX, including the content of the shopex official website. I hope it will be helpful to friends who are interested in PHP tutorials.