diff --git a/lib/DirScanner.php b/lib/DirScanner.php index 3531a0e..7cdd69b 100644 --- a/lib/DirScanner.php +++ b/lib/DirScanner.php @@ -535,6 +535,11 @@ Class DirScanner { return $this->webRoot; } + //设置扫描绝对根目录 + public function setRootDir($dir) { + $this->rootDir = realpath($dir); + } + //获取是否开启防盗链 public function isSecureOn() { return $this->nginxSecureOn; diff --git a/plugins/Common.php b/plugins/Common.php index 6767b83..957b950 100644 --- a/plugins/Common.php +++ b/plugins/Common.php @@ -535,7 +535,7 @@ Class Common { "ctime" => time(), "data" => $data, ); - $jsonData = json_encode($cacheData); + $jsonData = json_encode($cacheData, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); $cacheDir = __DIR__ . '/../runtime/cache/'; if (!is_dir($cacheDir)) { diff --git a/themes/beauty/controller/ListController.php b/themes/beauty/controller/ListController.php index 6668a98..1021b79 100644 --- a/themes/beauty/controller/ListController.php +++ b/themes/beauty/controller/ListController.php @@ -17,6 +17,7 @@ Class ListController extends Controller { $scanner = new DirScanner(); $scanner->setWebRoot(FSC::$app['config']['content_directory']); + $scanner->setRootDir(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory']); //优先从缓存读取数据 $prefix = FSC::$app['config']['theme']; diff --git a/themes/beauty/controller/SiteController.php b/themes/beauty/controller/SiteController.php index f0482ed..05d9e25 100644 --- a/themes/beauty/controller/SiteController.php +++ b/themes/beauty/controller/SiteController.php @@ -17,6 +17,7 @@ Class SiteController extends Controller { $scanner = new DirScanner(); $scanner->setWebRoot(FSC::$app['config']['content_directory']); + $scanner->setRootDir(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory']); //优先从缓存读取数据 $prefix = FSC::$app['config']['theme']; diff --git a/themes/beauty/views/site/index.php b/themes/beauty/views/site/index.php index a8502f9..8a0de13 100644 --- a/themes/beauty/views/site/index.php +++ b/themes/beauty/views/site/index.php @@ -4,8 +4,9 @@