php json_encode不支持對象私有屬性的解決方法

本文介紹php json_encode不支持對象私有屬性的解決方法,json_encode能夠把對象轉爲json格式,使用json_decode能夠還原爲對象。php 但若是對象內含有私有屬性,執行json_encode後,私有屬性會丟失。 web 例子:json_encode丟失對象私有屬性 <?php // 用戶類 class user{ public $id = 1; public $nam
相關文章
相關標籤/搜索