php 按月创建日志
public function log($log_string)
{
//$_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR."files".DIRECTORY_SEPARATOR."log".DIRECTORY_SEPARATOR;
$file_directory = "/var/log/white_and_black_list/";
if(!is_dir($file_directory)){
mkdir($file_directory, 0777, TRUE);
}
$log_info = PHP_EOL.date("H:i:s")
." ".($_SERVER['HTTP_TOKEN']??"noToken")
." ".$_SERVER['REQUEST_METHOD']
." ".$_SERVER['REQUEST_URI']
." ".file_get_contents("php://input")
." ".$log_string
.PHP_EOL;
file_put_contents($file_directory.date("Y-m").".log", $log_info, FILE_APPEND);
}