[php序列化]理解一下的

jackxiang 2007-4-30 15:18 | |
<?php
class man{
var $sex="男";
var $heigh=1010;
var $weight;
function run(){
echo "I am run !";
}
function sleep($sexs){
echo "I am sleep";
$this->sex=$sexs;

}


}
?>

<?php
$xiangdong=new man();
$xiangdong->sleep(女);
echo "$xiangdong->sex";
echo "$xiangdong->heigh";
echo "$xiangdong->heigh";

echo "$xiangdong->run()--------------";

echo $xiangdong->sleep("男的啊");
$xiangdong->sex;

$serialize=serialize($xiangdong);
echo "序列化后的结果:<br> ";

echo $serialize;
echo " 开始反序列化:";

$unserialize=unserialize($serialize);

echo $unserialize->sex;
echo "<br>";
echo "$unserialize->sleep(\"男的a啊\")";
?>

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/541/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2007-11-28 10:52
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]