|
我是初学者,刚被带参数分页折腾的头大了,也不想改CI系统文件,也不想用SESSION,用GET,还要改CONFIG,都头大,无奈之下折腾个办法出来:
页面:
<form method="post">
<input name="a" />
<input name="b" />
<select name="c"></select>
<select name="d"></select>
<submit>
</form>
控制器
$a = $this->input->post('a');
$b = $this->input->post('b');
$c = $this->input->post('c');
$d = $this->input->post('d');
$submit = $this->input->post('submit');
if(!empty($submit)){redirect('控制器/方法/'.$a.'/'.$b.'/'.$c.'/'.$d);}
$data['a'] = $this->uri->segment(3);
$data['b'] = $this->uri->segment(4);
$data['c'] = $this->uri->segment(5);
$data['d'] = $this->uri->segment(6);
//也就是提交后马上回提交页,将POST来的数据转换成CI的路径
if(uri_string() == '/控制器/方法/'){
$baseurl = '控制器/方法/0/0/0/0/'; //默认没提交前
}else{
$baseurl = '控制器/方法/'.$data['a'].'/'.$data['b'].'/'.$data['c'].'/'.$data['d'].'/'; //数据提交后
}
$config['uri_segment'] = 7;
数据
$a = $this->uri->segment(3);
$b = $this->uri->segment(4);
$c = $this->uri->segment(5);
$d = $this->uri->segment(6);
数据这部份自己加个 if(){} 判断下就可以了。 |
|