使用Codeigniter在数据库中存储站点配置/选项的最佳方法是什么?

时间:2017-11-20 11:32:07

标签: php codeigniter

是否有一些库可用于在网站数据库中存储网站配置字段数据,例如WordPress https://developer.wordpress.org/reference/functions/get_option/ 在Drupal https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/variable_get/7.x

或者存储网站变量有什么好的方法吗?并允许管理员也进行修改。我一直在CMS工作,只是在Codeigniter中找出更好的方法

1 个答案:

答案 0 :(得分:1)

Go to application > config > database file and edit database config.
    $active_group = 'default';
    $query_builder = TRUE;

    $db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'exampl_database',
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);