PHP 序列化函数 serialize、unserialize

$Info = array(
"trainA" => $trainA,
"trainB" => $trainB,
"trainC" => $trainC,
"try_hillockA" => $tryHillockA,
"try_hillockB" => $tryHillockB,
"try_hillockC" => $tryHillockC,
"postsA" => $postsA,
"postsB" => $postsB,
"postsC" => $postsC,
"matureA" => $matureA,
"matureB" => $matureB,
"matureC" => $matureC,
);

print_r(serialize($Info));
//输出结果为
a:12:{s:6:"trainA";s:1:"0";s:6:"trainB";s:1:"1";s:6:"trainC";s:1:"2";s:12:"try_hillockA";s:1:"3";s:12:"try_hillockB";s:1:"4";s:12:"try_hillockC";s:1:"5";s:6:"postsA";s:1:"6";s:6:"postsB";s:1:"7";s:6:"postsC";s:1:"8";s:7:"matureA";s:1:"9";s:7:"matureB";s:2:"10";s:7:"matureC";s:2:"11";}

//反序列化
print_r(unserializ($Info));
//输出结果为数组
Array ( 
[trainA] => 0
[trainB] => 1 
[trainC] => 2 
[try_hillockA] => 3 
[try_hillockB] => 4 
[try_hillockC] => 5 
[postsA] => 6 
[postsB] => 7
[postsC] => 8 
[matureA] => 9 
[matureB] => 10 
[matureC] => 11 
)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值