配置文件调整

控制器类的ajaxReturn方法调整
This commit is contained in:
thinkphp
2015-02-23 15:38:12 +08:00
parent 1a4a102b49
commit b8344fa91a
8 changed files with 78 additions and 65 deletions

View File

@@ -14,9 +14,9 @@ namespace think\log\driver;
class File {
protected $config = [
'log_time_format' => ' c ',
'log_file_size' => 2097152,
'log_path' => '',
'time_format' => ' c ',
'file_size' => 2097152,
'path' => '',
];
// 实例化并传入参数
@@ -32,11 +32,11 @@ class File {
* @return void
*/
public function write($log,$destination='') {
$now = date($this->config['log_time_format']);
$now = date($this->config['time_format']);
if(empty($destination))
$destination = $this->config['log_path'].date('y_m_d').'.log';
$destination = $this->config['path'].date('y_m_d').'.log';
//检测日志文件大小,超过配置大小则备份日志文件重新生成
if(is_file($destination) && floor($this->config['log_file_size']) <= filesize($destination) )
if(is_file($destination) && floor($this->config['file_size']) <= filesize($destination) )
rename($destination,dirname($destination).'/'.time().'-'.basename($destination));
error_log("[{$now}] ".$_SERVER['REMOTE_ADDR'].' '.$_SERVER['REQUEST_URI']."\r\n{$log}\r\n", 3,$destination);
}