<?php |
/** |
* 直接记录日志 |
* @param <type> $lvevel |
* @param string $level |
* http://www.phpqee.com |
*/ |
function Write( $msg , $level ) { |
$arr_level = explode ( ',' , YUC_LOG_TYPE); |
if (in_array( $level , $arr_level )) { |
$record = date ( 'Y-m-d H:m:s' ) . " >>> " . number_format(microtime(TRUE), 5, "." , "" ) . ' ' . " : " . $level . "\\t" . $msg ; |
$base = M_PRO_DIR . "/Log" ; |
$dest = $base . "/" . date ( "YmdH" , time()) . 'log.php' ; |
if (! file_exists ( $dest )) { |
@ mkdir ( $base , 0777, TRUE); |
@ file_put_contents ( $dest , "<?php die('Access Defined!');?>\\r\\n" , FILE_APPEND); |
} |
if ( file_exists ( $dest )) { |
@ file_put_contents ( $dest , $record . "\\r\\n" , FILE_APPEND); |
} |
} |
} |
//该片段来自于http://yuncode.net |