搜索表单:
<form action="<?php echo base_url()?>product/search" method="post">
<input type="text" name="proname" />
<button class="submit_btn" type="submit">TÌM KIẾM</button>
</form>
我的控制器:
function search(){
$product_name = trim($this->input->post('proname'));
$search = array('name' => $product_name);
$param = $this->uri->assoc_to_uri($search);
if($product_name == '/'){
redirect('product/search_result/'.$param);
}else{
redirect('product/search_result/'.$param);
}
}
function search_result(){
$result = $this->uri->segment_array();
$data['page_title'] = 'Result';
$data['pro'] = $this->data_mod->search_array('ebook',array('e_title_vn' => $result[4]));
$data['keyword'] = $result[4];
$this->load->view('search_result',$data);
}
当我回显关键字时(如$ this-&gt; uri-&gt; segment(4)),例如:
từ khóa
它会显示
t%E1%BB%AB%20kh%C3%B3a
我不知道为什么,有人可以帮助我吗?
(我的英语很差,很抱歉。我的语言是越南语。)
答案 0 :(得分:1)
$param
将被编码,您应该使用
urldecode($this->uri->segment(4));
将其显示正确。