How to store site wide settings in a database?

前端 未结 9 2933
时光说笑
时光说笑 2021-02-19 10:08

I\'m debating three different approaches to to storing sitewide settings for a web application.

A key/value pair lookup table, each key represents a setting.

    <
9条回答
  •  旧时难觅i
    2021-02-19 10:50

    If I had to choose, I'd go with the first option. It is easy to add/remove rows as you need. Whereas the single row could end up being a nightmare, and is probably a lot less scalable. And for option 3: It's possible you will regret hard coding your settings in the future, so you definitely don't want to box yourself in.

    Although you didn't list is as an option, is XML available? It is easy to set up, and gives you slightly more options, as you can nest settings within settings.

提交回复
热议问题