一个php日志类
<?php
//author:lixiuran
class Log {
public static function writeLog($string) {
$string = date('H:i:s') . ': ' . $string . "\r\n";
$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);
}
}