一个php日志类

<?php

//author:lixiuran

class Log {

    public static function writeLog($string) {

        $string = date('H:i:s') . ': ' . $string . " ";
        $dir = dirname(__FILE__) . '/' . date('Y');
        if ( ! is_dir($dir)) {
            @mkdir($dir);
        }
        $filename = $dir . '/' . date('Y-m-d') . '.log';
        $handle = @fopen($filename, 'a');
        @fwrite($handle, $string);
        @fclose($handle);
    }
}

原文地址:https://www.cnblogs.com/lixiuran/p/3386313.html