ShuanghongS 4 月之前
父节点
当前提交
acd4da553c
共有 1 个文件被更改,包括 6 次插入1 次删除
  1. 6 1
      service/robot.class.php

+ 6 - 1
service/robot.class.php

@@ -920,7 +920,12 @@ class robot{
          * JSON_ERROR_UNSUPPORTED_TYPE	8	不支持的数据类型
         */
         error_log("Real_message:".common::getChatAimessage($response['message']));
-        $message = json_decode(common::getChatAimessage($response['message']),true);
+
+        $brokenJson = common::getChatAimessage($response['message']);
+        // 用 \n 替换实际换行符
+        $brokenJson = str_replace("\n", "\\n", $brokenJson);
+
+        $message = json_decode($brokenJson,true);
         if ($message === null) {
             // 获取最后一次 JSON 操作的错误码
             $errorCode = json_last_error();