Browse Source

读取category.xml失败时,增加获取详细解析错误日志

zhouzhijian 9 năm trước cách đây
mục cha
commit
93a6b29839
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      helper/category_helper.php

+ 4 - 0
helper/category_helper.php

@@ -31,8 +31,12 @@ class category_helper
 
     private function load_xml($file)
     {
+        libxml_use_internal_errors(true);
         $xml = simplexml_load_file($file);
         if($xml === false) {
+            $err_msg = json_encode(libxml_get_errors(),JSON_UNESCAPED_UNICODE);
+            Log::record("{$err_msg}", Log::ERR);
+            libxml_clear_errors();
             throw new Exception("无法解析XML文件");
         }