From 313a1c5c8e154980c85df2e1fcea86bc11ff70dc Mon Sep 17 00:00:00 2001 From: Jiang Qinghua <841324345@qq.com> Date: Tue, 14 Jul 2020 22:45:27 +0800 Subject: [PATCH] Update LogViewer.php --- src/LogViewer.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/LogViewer.php b/src/LogViewer.php index dbe087f..b729146 100644 --- a/src/LogViewer.php +++ b/src/LogViewer.php @@ -81,19 +81,23 @@ class LogViewer protected function getRealPath($path) { - $paths = explode('/', $path); + try { + $paths = explode('/', $path); - $result = ''; - foreach ($paths as $v) { - $result .= $v.'/'; + $result = ''; + foreach ($paths as $v) { + $result .= $v.'/'; - $current = rtrim($result, '/'); - if (is_link($current)) { - $result = readlink($current).'/'; + $current = rtrim($result, '/'); + if (is_link($current)) { + $result = readlink($current).'/'; + } } - } - return rtrim($result, '/'); + return rtrim($result, '/'); + } catch (\Throwable $e) { + return $path; + } } protected function formatPath($path)