Array-PHP array storage database with Json_encode or serialize

Source: Internet
Author: User
Json_encode and serialize can make the array into a string into the database, two which is more convenient and efficient?

Reply content:

Json_encode and serialize can make the array into a string into the database, two which is more convenient and efficient?

It is recommended to use json standard format storage, which is not only convenient for making APIs but also available directly to other systems.

JSON is the most popular data storage format, the API is generally used json;serilize words, before in use, occasionally there will be a bug, that is, when the value of a certain character Fushiru semicolon, quotation marks, etc., will make unserialize () The result of a problem.

Good with JSON, encoding and decoding efficiency is higher than serialize, and the generated encoding content is less than serialize, more critical is to reduce the unserialize caused by a variety of inexplicable errors

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.