我的序列化数据如下所示
a:6:{i:0;s:12:"Early humans";i:1;s:32:"Apes And Hominids Dart's Find";i:2;s:36:"The hunter gatherers of South Africa";i:3;s:25:"Early Humans The Eve Gene";i:4;s:50:"Australopithecines, Homo ergaster and Homo sapiens";i:5;s:21:"Landscapes of history";}当我尝试反序列化时,结果是空的。
我的代码:
$urlnames = unserialize($row['url_name']);
foreach($urlnames as $names){
echo $name;
}我做错了什么?
谢谢
发布于 2011-09-08 20:43:11
序列化字符串错误。"Dart's find“字符串中应该还有一个字符--我不知道为什么会缺少一个字符,但是添加一个字符就可以使其正常工作。
。
发布于 2011-09-08 21:00:40
在索引1上,您只有31个字符,这就是它无法工作的原因。
发布于 2011-09-08 21:41:40
你从数据库中得到序列化的字符串了吗?
如果你从那里得到它,那么你的反斜杠就不见了。这是你的第32个角色。
更多关于反斜杠和数据库的信息,请查看google/yahoo/bing ...
https://stackoverflow.com/questions/7348101
复制相似问题