首頁  >  文章  >  後端開發  >  怎么对序列化后的数据进行查询

怎么对序列化后的数据进行查询

WBOY
WBOY原創
2016-06-13 13:33:071060瀏覽

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


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));
<br /><font color="#e78608">------解决方案--------------------</font><br>什么意思? 查询数据库?  <br>$s='你的串';<br>select * from tt where `字段`='$s';
<br><font color="#e78608">------解决方案--------------------</font><br>反序列化之后在查 <div class="clear">
                 
              
              
        
            </div>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn