这是我目前的PHP代码我格式化输出JSON更具可读性
while ($row = mysql_fetch_array($result))
{
$post = new Post();
$post->setId($row['post_id']);
$post->setBody($row['post_body']);
$post->setImage($row['post_imgurl']);
$post->setStamp($row['post_stamp']);
$postList[] = $post;
}
return array('post'=> $postList);
}
,这是它的output JSON。 如何让我的JSON更具可读性并删除/
这个角色?
更可读的输出:
什么叫“读”是什么意思? – thenewseattle
更可读的地方?这里有什么*真实*问题? '/'需要在JSON字符串中转义,这就是它的工作原理(请参阅:http://json.org/) –
如果您不转义反斜杠,它将不是有效的JSON。实际输出图像值时,它看起来像什么? –