Fastest way to store easily editable config data in PHP?

后端 未结 7 1396
借酒劲吻你
借酒劲吻你 2020-12-01 03:46

What is the fastest way to store config data in PHP so that it is easily changeable (via PHP)? First I thought about having config.php file, but I can\'t edit it on fly with

7条回答
  •  感情败类
    2020-12-01 04:36

    I use a database with a table called config or settings. The table has two columns:

    name [varchar(255)]
    value [varchar(255)]
    

    This allows the easy storage of int's, float's, and short strings.

    Then I create two functions, GetSetting and SetSetting. These store a row and retrieve a row, respectively. I find that this simplifies the storing of values tremendously.

提交回复
热议问题