本文讲述了php格式化json函数的示例代码。分享给大家供大家参考,具体如下:
<?php
$arr = array(ret=>0,data=>array('a' => 1, 'b' => '2', 'c' => 3, 'd' => 4, 'e' => 5));
$json = json_encode($arr);
/**
* Formats a JSON string for pretty printing
*
* @param string $json The JSON to make pretty
* @param bool $html Insert nonbreaking s