用户
 找回密码
 入住 CI 中国社区
搜索
查看: 5001|回复: 11
收起左侧

[已解决] 如何设置config文件里的配置项。

[复制链接]
发表于 2010-8-5 19:12:18 | 显示全部楼层 |阅读模式
按照手册上说$this->config->set_item('a','b')没用。怎么办
 楼主| 发表于 2010-8-5 19:25:40 | 显示全部楼层
自己顶啊
发表于 2010-8-5 20:50:47 | 显示全部楼层
软改?还是硬改啊?
手册上的那个是运行中改变值的吧,不会去改写物理文件的,我发个硬改给你看看吧
PHP复制代码
 
function apply_options(){
                $template = "<?php  if !defined('BASEPATH')) exit('No direct script access allowed');\n/*\n|--------------------------------------------------------------------------\n| XX站点设置\n|--------------------------------------------------------------------------\n*/\n\$config\['site_title'] = '{site_title}' ; \n\$config\['site_meta'] = '{site_meta}';\n\$config\['site_keyword'] = '{site_keyword}';\n\$config\['enable_cache'] = {enable_cache} ;\n\$config\['cache_time'] = {cache_time} ;\n/* End of file sys_options.php */\n/* Location: ./application/config/sys_options.php */\n";
                $template = str_replace('{site_title}',$this->input->post("
site_title",true),$template);
                $template = str_replace('{site_meta}',$this->input->post("
site_meta",true),$template);
                $template = str_replace('{site_keyword}',$this->input->post("
site_keyword",true),$template);
                $template = str_replace('{enable_cache}',$this->input->post("
enable_cache",true),$template);
                $template = str_replace('{cache_time}',$this->input->post("
cache_time",true),$template);
                $template = str_replace('\[','[',$template);
                $template = str_replace('\$','$',$template);
                if(file_put_contents(APPPATH."
config/sys_options.php",$template)){
                        $this->show_message("
success","站点配置成功");
                }else{
                        $this->show_message("
fail","站点配置失败");
                }
        }
复制代码

配置文件是这样的,这样修改后文件还是下面这个样子的
QQ截图未命名.jpg
发表于 2010-8-5 21:26:22 | 显示全部楼层
软改?还是硬改啊?
手册上的那个是运行中改变值的吧,不会去改写物理文件的,我发个硬改给你看看吧
配置文 ...
ywqbestever 发表于 2010-8-5 20:50

不好意思啊,问点题外话,请问这个是什么编辑器?可否贡献一下配色方案?:-)
发表于 2010-8-6 01:02:42 | 显示全部楼层
不好意思啊,问点题外话,请问这个是什么编辑器?可否贡献一下配色方案?:-) ...
ici 发表于 2010-8-5 21:26



    同求。
 楼主| 发表于 2010-8-6 08:56:47 | 显示全部楼层
我也是类似的配色方案,不过字符串是褐色的。我用的是dw5就不知道二楼用的是什么了
发表于 2010-8-6 09:24:23 | 显示全部楼层
呵呵,这个编辑器是Intype,还是测试的,功能不多哈
http://intype.info/home/
配色方案是他自带的“blackboard”主题,有兴趣的可以下来看看
发表于 2010-8-6 09:45:45 | 显示全部楼层
呵呵,这个编辑器是Intype,还是测试的,功能不多哈

配色方案是他自带的“blackboard”主题,有兴趣的可以 ...
ywqbestever 发表于 2010-8-6 09:24



   感谢!
发表于 2010-8-6 18:46:09 | 显示全部楼层
来迟了,去试试
:)
发表于 2010-8-13 16:41:21 | 显示全部楼层
去试试!

本版积分规则