<?php
...
$json_string = json_encode($data, JSON_PRETTY_PRINT);
...
?>

Bitmask consisting of JSON_FORCE_OBJECT, JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_INVALID_UTF8_IGNORE, JSON_INVALID_UTF8_SUBSTITUTE, JSON_NUMERIC_CHECK, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_PRESERVE_ZERO_FRACTION, JSON_PRETTY_PRINT, JSON_UNESCAPED_LINE_TERMINATORS, JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE, JSON_THROW_ON_ERROR.

https://www.php.net/manual/en/json.constants.php

SON_PRETTY_PRINT (int)
Use whitespace in returned data to format it.

本文链接地址:https://const.net.cn/639.html

标签: none

添加新评论