Home  >  Article  >  Backend Development  >  怎么对序列化后的数据进行查询

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

WBOY
WBOYOriginal
2016-06-13 10:20:251095browse

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


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=<<<STRa: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>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn