Copy code The code is as follows:
**
* Write file
* @param string $file File path
* @param string $str Write content
* @param char $mode Write mode
* /
function writeFile($file,$str,$mode='w')
{
$oldmask = @umask(0);
$fp = @fopen($file,$mode);
@flock($fp , 3);
if(!$fp)
{
Return false;
}
else
{
@fwrite($fp,$str);
@fclose($fp);
@umask($oldmask);
Return true;
}
}
Copy the code The code is as follows:
function writeGetUrlInfo()
{
//Get the address of the requester , client, requested page and parameters
$requestInformation = $_SERVER['REMOTE_ADDR'].', '.$_SERVER['HTTP_USER_AGENT'].', http://'.$_SERVER['HTTP_HOST'].htmlentities ($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING']."n";
$fileName = RootPath.'/log/'.date('Y-m-d').'.log '; //The website root directory RootPath is in the configuration file define('RootPath', substr(dirname(__FILE__)));
writeFile($fileName, $requestInformation, 'a'); //Indicates appending
}
The above introduces the phison-up10 mass production tool v1.78.00 PHP text log implementation code, including the content of phison-up10 mass production tool v1.78.00. I hope it will be helpful to friends who are interested in PHP tutorials.