Look at the serialization theme of yesterday. How can this problem be solved?

Source: Internet
Author: User
Look at the serialization theme of yesterday. In many e-commerce websites, it is very common to fill in personal information, product information, Bill information, but some Cainiao like a field of information, Nima, and finally quit, it's okay for him, and later users will be in trouble. there are more and more tables, more and more fields, and it's no longer possible to refactor them. they can only pile up. Over time, the appearance is gorgeous, and the serialization theme of yesterday is felt inside the spam.
In many e-commerce websites, it is very common to fill in personal information, product information, and Bill Information.

However, some Cainiao like a field named "information", Nima. after leaving the company, he will be okay. later, he will be in trouble,

There are more and more tables and more fields. it is no longer possible to refactor the tables.

Over time, a web system with a gorgeous appearance and internal garbage has been formed.



------ Solution --------------------
So in what projects are serialization and deserialization commonly used?
It seems to be stored in json format.
I have seen this method on e-commerce platforms before, and also in Flex.
------ Solution --------------------
Different scenarios
PHP code
Class T {var $ v = 1; function see () {echo $ this-> v ;}}$ p = new T; $ p-> v = 'abc '; $ p-> see (); // abcd $ s = json_encode ($ p); $ t = json_decode ($ s); $ t-> see (); // Call to undefined method stdClass: see () $ s = serialize ($ p); $ t = unserialize ($ s); $ t-> see (); // abcd
------ Solution --------------------
Typical examples of moderators ......
Add to favorites.
------ Solution --------------------
It is better to have more data than to have no data. Of course, it is unreasonable to save only the design. How cool are code writers? how come?
------ Solution --------------------
Database fields can be designed using mysql key-> value.
------ Solution --------------------
The landlord is so bad? As long as the multi-table multi-field is reasonable, some fields must be used.
It's not a big problem to search, sort, etc.

It can also be designed as in the upstairs, where one field is the field name and the other field is the value.
------ Solution --------------------
How nice is it if all things can be exported using a field theory?
But unfortunately, it cannot be done.

Never try to cover the vast universe with simple rules

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.