From 73c931089de25675bb11c70b8edd7aab340507ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BA=A6=E5=BD=93=E8=8B=97=E5=84=BF?= Date: Mon, 1 Feb 2016 23:40:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DNotice=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Exception.php | 8 ++++---- library/think/log/driver/File.php | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/library/think/Exception.php b/library/think/Exception.php index ff6e4726..abf32018 100644 --- a/library/think/Exception.php +++ b/library/think/Exception.php @@ -15,7 +15,7 @@ namespace think; * ThinkPHP核心异常类 * 所有系统异常必须继承该类 */ -class Exception extends \Exception +class Exception extends \Exception { /** * 系统异常后发送给客户端的HTTP Status @@ -32,7 +32,7 @@ class Exception extends \Exception /** * 设置异常额外的Debug数据 * 数据将会显示为下面的格式 - * + * * Exception Data * -------------------------------------------------- * Label 1 @@ -41,11 +41,11 @@ class Exception extends \Exception * Label 2 * key1 value1 * key2 value2 - * + * * @param string $label 数据分类,用于异常页面显示 * @param Array $data 需要显示的数据,必须为关联数组 */ - final protected function setData($label, Array $data) + final protected function setData($label, array $data) { $this->data[$label] = $data; } diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 6cd01c2d..89eb000a 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -68,7 +68,10 @@ class File foreach ($log as $line) { $info .= '[' . $line['type'] . '] ' . $line['msg'] . "\r\n"; } - error_log("[{$now}] {$_SERVER['SERVER_ADDR']} {$_SERVER['REMOTE_ADDR']} {$_SERVER['REQUEST_URI']}\r\n{$info}\r\n", 3, $destination); + + $server = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '0.0.0.0'; + $remote = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; + error_log("[{$now}] {$server} {$remote} {$_SERVER['REQUEST_URI']}\r\n{$info}\r\n", 3, $destination); } }