如何解析从Mysql返回到php,json_encode的字符串中的特殊字符

时间:2017-03-03 14:04:05

标签: php mysqli

我的文本中存在特殊的HTML实体,存储在mysql中。当我尝试使用json_encode将从mysql返回的数据读入PHP时,它会无声地失败。当我使用json_encode(array_map('utf8_encode', $row));时,它会将输出显示为

    ["{\"autoid\":\"2\",\"package_id\":\"a78o5jax32\",\"chapter_title\":\"General Aspects of Surgery\",\"question_text\":\"Capsule Endoscopy-False statement is\",\"explanation\":\"
Capsule\\u00dd Endoscopy is not suitable for patients with strictures.<\\\/p>\",\"reference\":\"Bailey and Love 26th Edition P\\\/205\",\"options\":\"Sedation Not RequiredxxxxxxPainless ProcedurexxxxxxVisualize Entire small BowelxxxxxxSuitable For Patients With Stricture Bowel\",\"answer\":\"3\"}","{\"autoid\":\"3\",\"package_id\":\"a78o5jax33\",\"chapter_title\":\"General Aspects of Surgery\",\"question_text\":\"Physiological changes in laparoscopy include all excep\",\"explanation\":\"• Laparoscopy\\u00de causes increased PCWP, Intra cranial Pressure and decreased Functional Residual capacity after expiration is decreased after laparoscopy gas insuffulation.
• There will be Hypercarbia and acidosis (pH decrease)
\",\"reference\":\"Ref: Schwartz Page 417\\\/ 10th Edition\",\"options\":\"Increases PCWPxxxxxxIncreased ICPxxxxxxDecreased FRCxxxxxxIncreased pH\",\"answer\":\"4\"}"]

无法解析为json。

请帮助我如何获得在mysql文本中创建的特殊实体并创建json。我稍后会在jquery ajax中使用json。

特殊实体就像Ý

0 个答案:

没有答案