我正在尝试向CJSON::encode添加一个新的行\n,但是它正在添加另一个忽略该命令的\。我应该如何处理CJSON::encode release \n
代码:
CJSON::encode(array('error'=>'First Line\nSecond Line'))返回:
{"error":"First Line\\nSecond Line"}我想要的:
{"error":"First Line\nSecond Line"}发布于 2013-01-29 17:47:46
好吧,这不是什么大问题。
您不能使用简单的引号在字符串中添加新行:
http://php.net/manual/language.types.string.php#language.types.string.syntax.single
您应该尝试:
CJSON::encode(array('error'=>"First Line\nSecond Line"))https://stackoverflow.com/questions/14577541
复制相似问题