$settings array or Config Class to store project settings?

后端 未结 7 1670
眼角桃花
眼角桃花 2021-02-04 16:25

How should I store settings for project?

Which is better - to use a $settings array with all my settings:

$settings[\'max_photos\'] = 30;
//         


        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-04 16:56

    If the project settings is too heavy, then file(xml is better) is good and a dedicated class for settings is also good.

    If the project settings is small, then array is best, its very fast and no I/O related issue will arise.

    Even you can use database (slower and auth issue).

提交回复
热议问题