php - 为什么json解码后不打印空值?
问题描述
当 json 解码工作时,它会从数组中删除 Null 或 0 值,为什么?
下面的例子。
Array ( [address] => Array ( [address] => [postalCode] => [phoneNumber] => testing [city] => ) )
我得到了这个为什么它没有在空值或 0 中显示 null。
$test = '{"address": {
"address": null,
"postalCode": null,
"phoneNumber": "testing",
"city": null
}}';
$test_decoded =json_decode($test, true);
print_r($test_decoded);
它应该返回 null 值或 0 值
解决方案
推荐阅读
- angular - 当我在 Angular 6 的输入标签中输入一些文本时,如何更改发送按钮颜色?
- eclipse - Eclipse Vaadin Widgetset 编译堆大小问题
- continuous-integration - 在声明性 Jenkins 脚本块中,我应该如何在执行命令时引用变量?
- asp.net - 我应该将身份服务器数据库与应用程序数据库合并吗?
- css - Wordpress中页脚下方的间隙
- laravel - 如果 laravel 中存在图像,如何避免编辑表单中需要图像?
- android - 为谷歌短信检索器 api 生成哈希字符串 - 'xxd' 未被识别为内部或外部命令
- xamarin - 如何管理 xamarin 表单应用程序的实时更新?
- mongodb - MongoDB中不稳定的插入率
- r - 如何自动限制 rpivottable 中的视图以符合数据保护要求