JSON vs. Serialized Array in database(JSON 与数据库中的序列化数组)
本文介绍了JSON 与数据库中的序列化数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 MySQL 数据库中存储 JSON 数据与序列化数组相比有哪些优缺点?
What are the advantages and disadvantages of storing JSON data in MySQL database vs. serialized array?
推荐答案
- JSON 编码() &解码()
- PHP 版本 >= 5.0.0
- 嵌套限制为 20.
- PHP 版本 >= 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 与数据库中的序列化数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:JSON 与数据库中的序列化数组


猜你喜欢
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- Laravel 仓库 2022-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 没有作曲家的 PSR4 自动加载 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01