为什么80%的码农都做不了架构师>>>
本地测试环境中
apahche httpd-vhosts.conf 中添加虚拟主机例如 test.demo.com
增加变量
SetEnv CI_ENV "development"
本地hosts文件 增加对应 ip 如127.0.0.1 test.demo.com
CI application config 文件夹中 config.php文件
添加以下信息 switch (ENVIRONMENT) { case development: $config[base_url] test.demo.com; break; case production: $config[base_url] www.demo.com; break; }
数据库对应设置 以sae为例
CI application config 文件夹中 database.php文件
switch (ENVIRONMENT) { case development: $db[default] array( dsn > , /**** localhost ***/ port > 3306, hostname > 127.0.0.1, username > root, password > root, database > ci, /**************************/ 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 ); break; default: $db[default] array( dsn > , /**** sae配置 ***/ hostname > SAE_MYSQL_HOST_M, port > SAE_MYSQL_PORT, username > SAE_MYSQL_USER, password > SAE_MYSQL_PASS, database > SAE_MYSQL_DB, /*************************/ 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 ); }
转:https://my.oschina.net/soci/blog/794280
【文章转自:美国站群服务器 http://www.558idc.com/mgzq.html处的文章,转载请说明出处】