Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- logger();
- function logger(){
- #Write log contents by date/time
- $content = "Log by time";
- $now = time();
- $ymd = 'logs/'.date('Y-m-d', $now);
- $template = date('H:m:s', $now)." - ".$content;
- $file_name = $ymd.'/'.date('H', $now).'.log';
- if(!is_dir($ymd)){
- mkdir($ymd, 0777, true);
- }
- $current = $template . PHP_EOL;
- $f = fopen($file_name, 'a');
- fwrite($f, $current);
- fclose($f);
- #End write log contents by date/time
- }
Advertisement
Add Comment
Please, Sign In to add comment