douhao2548 2011-03-18 15:51
浏览 96
已采纳

PHP变量处理函数,serialize()

First off I've read the PHP manual, I've tested it out. Second I still don't understand what it really does? Why would I want to serialize a variable?

  • 写回答

6条回答 默认 最新

  • donglu1973 2011-03-18 15:58
    关注

    You probably wouldn't want to serialise a variable as such, but it is useful to serialise objects and other complex data structures.

    Instead of creating a database table with loads of columns, create a table with a primary key and a blob and serialise a class or array into it. That way you have an infinitly flexible system where if you need to add new data to the database table you don't have to add more columns.

    This is one silly example, but persisting objects into a database is seriously useful if you think about it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入