JSON与数据库中的序列化数组 [英] JSON vs. Serialized Array in database
本文介绍了JSON与数据库中的序列化数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在MySQL数据库和序列化数组中存储JSON数据的优缺点是什么?
What are the advantages and disadvantages of storing JSON data in MySQL database vs. serialized array?
推荐答案
- JSON encode() & decode()
- PHP Version >= 5.0.0
- Nesting Limit of 20.
- PHP Version >= 5.0.0
- 嵌套限制为128.
- 嵌套限制为512.
- PHP版本> = 4.0.0
- 方法不会在PHP数据类型对象上丢失.
- __ wakeup()魔术方法,对任何要反序列化的对象进行调用. (非常强大)
- 已经注意到,有时最好base64编码字符串放入数据库中,然后 base64使用此功能对从数据库中取出的字符串进行解码,因为某些空白字符的处理存在一些问题.
- PHP Version >= 4.0.0
- Methods are not lost on PHP Datatype Object.
- __wakeup() magic method called on any object being unserialize. (VERY POWERFUL)
- It has been noted that it is some times best the base64 encode strings put into the database, and base64 decode strings taken out of the database with this function, as there are some issues with the handling of some white space characters.
由您选择.
这篇关于JSON与数据库中的序列化数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文