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