我在开源程序中的MYSQL见到了这些东西,请问这些东西是什么?

WBOY
Release: 2016-06-06 20:41:09
Original
960 people have browsed it

在他的user表;里面有这样这样一个字段叫做email_setting:
里面的值是这样的:
a:2:{s:9:"FOLLOW_ME";s:1:"N";s:10:"NEW_ANSWER";s:1:"N";}
请问这是啥意思?
user表里面有一个rencent_topic字段,也是这样的:
a:1:{i:0;s:6:"化妆";}
为什么有的字段会有这么奇怪的字符?

这个开源程序叫做wecenter。
多谢楼下的回答,当存储一个二进制数据的时候,就可以序列化。但是我想假设存一个数组。我可以json存进去,也可以序列化存进去。
谁更好一些?

回复内容:

在他的user表;里面有这样这样一个字段叫做email_setting:
里面的值是这样的:
a:2:{s:9:"FOLLOW_ME";s:1:"N";s:10:"NEW_ANSWER";s:1:"N";}
请问这是啥意思?
user表里面有一个rencent_topic字段,也是这样的:
a:1:{i:0;s:6:"化妆";}
为什么有的字段会有这么奇怪的字符?

这个开源程序叫做wecenter。
多谢楼下的回答,当存储一个二进制数据的时候,就可以序列化。但是我想假设存一个数组。我可以json存进去,也可以序列化存进去。
谁更好一些?

楼上说的对,补充一下,由于数据库不能存数组,只能将其用php的序列化函数转化为一串字符串。
我们可以用unserialize()对字符串进行反序列化,得到的结果是:

<code>Array ( [FOLLOW_ME] => N [NEW_ANSWER] => N ) 
Array ( [0] => 化妆 ) 
</code>
Copy after login

这是序列化的数据,php里是用serialize()处理得来的字串

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!