|
发表于 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 ","站点配置失败 ");
}
}
复制代码
配置文件是这样的,这样修改后文件还是下面这个样子的
|
|