日期:2014-05-17  浏览次数:20546 次

如何对序列化后的数据进行查询?
如何对序列化后的数据进行查询?


a:3:{s:4:"feed";a:5:{s:5:"doing";i:1;s:4:"blog";i:1;s:6:"upload";i:1;s:4:"poll";i:1;s:9:"newthread";i:1;}s:4:"view";a:8:{s:5:"index";i:0;s:6:"friend";i:0;s:4:"wall";i:0;s:4:"home";i:0;s:5:"doing";i:0;s:4:"blog";i:0;s:5:"album";i:0;s:5:"share";i:0;}s:7:"profile";a:8:{s:8:"realname";i:3;s:6:"gender";i:3;s:8:"birthday";i:3;s:9:"birthcity";i:3;s:10:"residecity";i:3;s:15:"affectivestatus";i:0;s:10:"lookingfor";i:0;s:9:"bloodtype";i:0;}}


像这样的。

------解决方案--------------------
PHP code
<?php
$str=<<<STR
a:3:{s:4:"feed";a:5:{s:5:"doing";i:1;s:4:"blog";i:1;s:6:"upload";i:1;s:4:"poll";i:1;s:9:"newthread";i:1;}s:4:"view";a:8:{s:5:"index";i:0;s:6:"friend";i:0;s:4:"wall";i:0;s:4:"home";i:0;s:5:"doing";i:0;s:4:"blog";i:0;s:5:"album";i:0;s:5:"share";i:0;}s:7:"profile";a:8:{s:8:"realname";i:3;s:6:"gender";i:3;s:8:"birthday";i:3;s:9:"birthcity";i:3;s:10:"residecity";i:3;s:15:"affectivestatus";i:0;s:10:"lookingfor";i:0;s:9:"bloodtype";i:0;}}
STR;
print_r(unserialize($str));

------解决方案--------------------
什么意思? 查询数据库? 
$s='你的串';
select * from tt where `字段`='$s';
------解决方案--------------------
反序列化之后在查