123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
- class Lin_Loader extends CI_Loader
- {
- function __construct()
- {
- parent::__construct();
- }
-
- /**
- *
- * 设置视图路径
- * @param unknown_type $switcher
- * @param unknown_type $theme
- * @param unknown_type $path
- */
- function switch_theme($switcher = 'on' , $theme = 'default' ,$path = 'template'){
-
- if($switcher == 'on')
- {
- $this->_ci_view_paths = array(FCPATH.$path.'/'.$theme.'/' => TRUE);
- }
-
- }
- /** 自定义配置数据库 重写model */
- public function _model($model, $name = '', $db_conn = FALSE){
- //载入数据库配置
- $db['hostname'] = 'rm-m5ecwg58yn1y34yzq.mysql.rds.aliyuncs.com'; //数据库的主机名
- $db['username'] = 'crowd'; //需要连接到数据库的用户名
- $db['password'] = 'Qq89757!'; //登录数据库的密码
- $db['database'] = 'crowd'; //需要连接的数据库名
- $db['dbdriver'] = 'mysqli';//数据库类型。
- $db['dbprefix'] = 'crowd_'; //表前缀
- $db['pconnect'] = TRUE; //是否使用持续连接
- $db['db_debug'] = TRUE; //是否显示数据库错误信息
- $db['cache_on'] = FALSE; // 是否开启数据库查询缓存
- $db['cachedir'] = ''; //数据库查询缓存目录所在的服务器绝对路径
- $db['char_set'] = 'utf8mb4'; //与数据库通信时所使用的字符集
- $db['dbcollat'] = 'utf8mb4_general_ci'; //与数据库通信时所使用的字符规则
- $db['swap_pre'] = ''; //替换默认的 dbprefix 表前缀
- $db['encrypt'] = FALSE; //是否使用加密连接。
- $db['compress'] = TRUE; //是否使用客户端压缩协议(只用于MySQL)
- $db['stricton'] = FALSE; //是否强制使用 "Strict Mode" 连
- $db['failover'] = array();
- $db['save_queries'] = TRUE;
- $this->model($model,$name,$db);
- }
- }
|