별로 좋아하는 방식의 해결책은 아니다. 하지만 고육지책으로 사용했다.
function parse_for_json($text) {
// Damn pesky carriage returns...
$text = str_replace("\r\n", "\n", $text);
$text = str_replace("\r", "\n", $text);
// JSON requires new line characters be escaped
$text = str_replace("\n", "\\n", $text);
return $text;
}
출처는 여기다.










댓글 남기기