xml數據,data裏的爲xml數據。註明:帶有\r\n的。
{"status_code":200,"msg":true,"data":"\r\n\r\n\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><response><error>0<\/error><message><\/message><\/response>\r\n\r\n"}
在進行轉換爲字符串simplexml_load_string的時候會報錯:XML declaration allowed only at the start of the document。
解決辦法:
rtrim($data) 加 ltrim($data)。曾經試過直接trim,但是不知爲何不管用。