Is there a table can only record a row of information Ah, such as corporate Web site, website introduction, set information, address, and other information, only need a line can, so how to build a table record it?

Source: Internet
Author: User
Is there a table can only record a row of information Ah, such as corporate Web site, website introduction, set information, address, and other information, only need a line can, so how to build a table record it?

Reply content:

Is there a table can only record a row of information Ah, such as corporate Web site, website introduction, set information, address, and other information, only need a line can, so how to build a table record it?

If you ask, we will encounter this scene, with the file word read and write more trouble, the file is more suitable for some fixed write dead configuration,
K-v words, with Memcache,redis memory database, but also worry about data loss. So MySQL is a relationship-based type, so
We can use the database skillfully and get a small k-v database.
Create a table with a key,value field that is designed to hold some information that may be read and written.
In fact, it is easy to get a simple type of k-v database.
A record represents a configuration.
For example, the configuration contains website information, administrator interface style, expiration time and so on.

id  dicKey       value1   web_info      "企业网站,网站介绍,设置信息,地址,等信息"2   admin_style  "green"3   expire       360

Next, as long as you encapsulate the logic
Can do get('key') it completely,set('key')

You can look at WordPress, a variety of CNS design styles, there is a System Setup table, name and Value fields,
Add a row settings,vlue for the serialized result of these key values, so that there is only one row

In this case, it doesn't use the database. Just need to write a configuration file in JSON or XML.

  • Related Article

    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.