How to store site wide settings in a database?

前端 未结 9 2908
时光说笑
时光说笑 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条回答
  •  后悔当初
    2021-02-19 10:32

    I am including using a separate PHP script with just the settings:

    $datatables_path = "../lib/dataTables-1.9.4/media";
    $gmaps_utils_dir =  "../lib/gmaps-utils";
    $plupload_dir = "../lib/plupload-1.5.2/js";
    $drag_drop_folder_tree_path = "../lib/dhtmlgoodies/drag-drop-folder-tree2";
    
    $lib_dir = "../lib";
    $dbs_dir = "../.no_backup/db";
    
    $amapy_api_registration_id = "47e5efdb-d13b-4487-87fc-da7920eb6618";
    $google_maps_api_key = "ABQIABBDp7qCIMXsNBbZABySLejWiBSmGz7YWLno";
    

    So it's your third variant.

    I don't actually see what you find hard on changing these values; in fact, this is the easiest way to administrate these settings. This is not the kind of data you want your users (with different roles) to change via web interface. Products like PHPMyAdmin and Joomla happily use this approach.

提交回复
热议问题