博客系统-3.0CodeIgniter系统SAE版本的配置 application/config/
- autoload.php(系统启动时自动加载的文件:包,类库,驱动,方法助手,配置)
- $autoload['libraries'] = array('database', 'access', 'pagination');//类库:数据库/权限类/分页类
- $autoload['drivers'] = array('session');//驱动:session
- $autoload['helper'] = array('url', 'file', 'cookie', 'form', 'array');//方法:url,文件,cookie,表单,数组
- $autoload['config'] = array('app');//配置:项目
- config.php 项目公共配置
- $config['enable_hooks'] = TRUE;//使用钩子
- $config['log_threshold'] = 0;//日志记录级别
- $config['log_path'] = '';//日志路径
- $config['cache_path'] = '';//缓存路径
- $config['encryption_key'] = 'blog_;//session加密
- $config['sess_expiration'] = 3600;//session过期时间
- $config['sae_output_cache'] = 'kvdb';//输出类页面缓存配置
- constants.php 静态变量
- define('PAGE_LIMIT', 10);//每页条数
- database.php 数据库,判断是否SAE环境,调用不同配置
- 判断是否是SAE环境
if ( ! function_exists('is_sae')) { /** * 检查是否是SAE环境 * * @return bool TRUE 代表是SAE */ function is_sae() { return function_exists('sae_debug'); } }
//根据环境选择数据库配置 $query_builder = TRUE; if (is_sae()) { $active_group = 'sae'; $db['sae'] = array( 'dsn' => '', 'hostname' => SAE_MYSQL_HOST_M, 'hostname_s' => SAE_MYSQL_HOST_S, 'username' => SAE_MYSQL_USER, 'password' => SAE_MYSQL_PASS, 'database' => SAE_MYSQL_DB, 'port' => SAE_MYSQL_PORT, 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => FALSE, 'db_debug' => TRUE, 'cache_on' => FALSE, 'cachedir' => '',//SAE数据库缓存, 使用kvdb进行缓存. 此配置值为key前缀, 例如 "dbcache_". 若不设置, 则不缓存 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'autoinit' => TRUE, 'encrypt' => FALSE, 'compress' => FALSE, 'stricton' => FALSE, 'failover' => array(), 'save_queries' => TRUE ); } else { $active_group = 'local'; $db['local'] = array( 'dsn' => '', 'hostname' => '127.0.0.1', 'username' => 'root', 'password' => 'root', 'database' => 'blog', 'port' => '3306', 'dbdriver' => 'mysqli', 'dbprefix' => '', 'pconnect' => FALSE, 'db_debug' => TRUE, 'cache_on' => FALSE, 'cachedir' => '', 'char_set' => 'utf8', 'dbcollat' => 'utf8_general_ci', 'swap_pre' => '', 'autoinit' => TRUE, 'encrypt' => FALSE, 'compress' => FALSE, 'stricton' => FALSE, 'failover' => array(), 'save_queries' => TRUE ); }
- routes.php 默认路由
$route['default_controller'] = 'site'; $route['404_override'] = ''; $route['translate_uri_dashes'] = FALSE;