您的位置:首页 > 其它

Vim分屏

2011-12-22 20:17 176 查看
<iframe align="center" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog336280.html" frameborder="0" width="336" scrolling="no" height="280"></iframe>

相信经常处理XML的朋友一定会用过simplexml_load_string,他将XML变成对象,十分方便。但如果你想把这个对象序列化后缓存起来,可要小心了。写Cache的时候没有问题,但读取Cache的时候会出错,错误是“Node no longer exists in xxxx.php on line 15“。错误是由于在反序列化simplexml对象时发生的。大概是PHP的Bug吧。

下边的代码可以验证我的经历,以后序列化simplexml对象时要小心了。


php


$data=XML


xmlversion='1.0'?>


articles>


article>


title>王开源PK比尔title>


article>


articles>


XML;


$xml=simplexml_load_string($data);


$str=serialize($xml);


echo"$str ";


$new_xml=unserialize($str);


echoserialize($new_xml)." ";


?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: