Deserializing from JSON into PHP, with casting?

前端 未结 12 2048
既然无缘
既然无缘 2021-01-31 04:38

Suppose I have a User class with \'name\' and \'password\' properties, and a \'save\' method. When serializing an object of this class to JSON via json_encode, the method is pro

12条回答
  •  长情又很酷
    2021-01-31 04:51

    Bit late but another option is to use symfony serializer to deserialize xml, json, whatever to Object.

    here is documentation: http://symfony.com/doc/current/components/serializer.html#deserializing-in-an-existing-object

提交回复
热议问题