Debug.class.php 851 Bytes
<?php
class Lib_Debug
{
	/**
	 * 记录日志
	 * @param unknown $message
	 */
	public static function log($message)
	{
		//$file = dirname(__FILE__).'/../cache/log.txt';
		$file = '/Data/img01/log.txt';
		$message .= PHP_EOL ; 
		file_put_contents($file,$message,FILE_APPEND);
	}
    
    public static function logger($msg)
    {
        $fileurl = dirname(dirname(__FILE__)).DS.date('Y-m-d').'log.txt';
    	$data = '['.date('Y-m-d H:i:s').'] Request Url: '.$_SERVER["REQUEST_URI"].urldecode($_SERVER["QUERY_STRING"]).PHP_EOL;
    	$data .= '                      User Agent: '.$_SERVER["HTTP_USER_AGENT"].PHP_EOL;
    	foreach((is_array($msg) ? $msg : array($msg)) as $k => $v)
    	{
    		$data .= '                      '.($k ? :'').': '.$v.PHP_EOL;
    	}
    	$file = fopen($fileurl,'a');
    	fwrite($file,$data);
    	fclose($file);
    }
}