简体   繁体   English

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

[英]What is the best way to store site configuration/option in database using Codeigniter?

Is there some library available to store site configurations fields data in database, like in WordPress https://developer.wordpress.org/reference/functions/get_option/ and in Drupal https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/variable_get/7.x 是否有一些库可用于在数据库中存储站点配置字段数据,例如WordPress https://developer.wordpress.org/reference/functions/get_option/和Drupal https://api.drupal.org/api/drupal/包括%21bootstrap.inc /功能/ variable_get / 7.x的

Or is there any good approach to store site variables? 还是有什么好的方法来存储站点变量? and allow admin to modify also. 并允许管理员也进行修改。 I have been working in CMS just checking out better approaches in Codeigniter 我一直在CMS中工作,只是在Codeigniter中检查出更好的方法

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
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM