From c2ac463a5c3adfdfd317ccefbc2e6b3bcd8db534 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 21 Dec 2015 19:13:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=A9=B1=E5=8A=A8=E5=A2=9E=E5=8A=A0=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=A4=9A=E7=BA=A7=E5=88=9B=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/cache/driver/file.php | 4 +--- library/think/log/driver/file.php | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/library/think/cache/driver/file.php b/library/think/cache/driver/file.php index de5515ed..a5f7e5cb 100644 --- a/library/think/cache/driver/file.php +++ b/library/think/cache/driver/file.php @@ -40,7 +40,6 @@ class File if (substr($this->options['path'], -1) != '/') { $this->options['path'] .= '/'; } - $this->init(); } @@ -53,10 +52,9 @@ class File { // 创建项目缓存目录 if (!is_dir($this->options['path'])) { - if (!mkdir($this->options['path'], 0755)) { + if (!mkdir($this->options['path'], 0755, true)) { return false; } - } } diff --git a/library/think/log/driver/file.php b/library/think/log/driver/file.php index 9fb711c8..6cd01c2d 100644 --- a/library/think/log/driver/file.php +++ b/library/think/log/driver/file.php @@ -39,10 +39,13 @@ class File $now = date($this->config['time_format']); $destination = $this->config['path'] . date('y_m_d') . '.log'; + !is_dir($this->config['path']) && mkdir($this->config['path'], 0755, true); + //检测日志文件大小,超过配置大小则备份日志文件重新生成 if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { rename($destination, dirname($destination) . DS . time() . '-' . basename($destination)); } + // 获取基本信息 if (isset($_SERVER['HTTP_HOST'])) { $current_uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];