本文介紹了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 與數據庫中的序列化數組的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!