我從富文本區域中檢索文本並嘗試放入json。 我有這樣一個JSON:JSON解碼崩潰
{"content":"<p>Mauritian politics is vibrant and characterised by several problems.
Some of them are coalition...","title":"sdddddddddddddddddddddddddddddddddddddddddddddd","interestId":"11","commentType":"Post"}
現在,當我試圖解析在PHP上述JSON,它是失敗給了我一個空白JSON。
我知道問題是什麼,問題在於'有幾個問題'之後的空間。因爲我解析這個,所以沒關係
{"content":"<p>Mauritian politics is vibrant and characterised by severak problems.Some of them are coalition...","title":"sdddddddddddddddddddddddddddddddddddddddddddddd","interestId":"11","commentType":"Post"}
這不是一個空間,它是一個回車,從字符串中刪除它,你應該罰款。如果你想保留額外的行,使用nl2br()。 – Jon