标签:
常用于model的操作,看看就知道了
<?php class UserModel { var $user_id = 0; var $user_name = ‘‘; var $user_email = ‘‘; var $user_pwd = ‘‘; function UserModel() { } } ?>
使用json_encode将Model序列化为json
$md->user_id = ‘3‘; $md->user_name = ‘Lee‘; $md->user_email = "928532756@qq.com"; $md->user_pwd = ""; $json = json_encode($md)
exit($json);
使用json_decode将json反序列化为model
$md = json_decode($json);
var_dump($md);
php model与json_encode/json_decode
标签:
原文地址:http://www.cnblogs.com/CyLee/p/5569436.html