我有观点:
<?php echo form_open_multipart('search/item');?>
<input type='text' name='search' value="<?php echo set_value('search')?>">
<input type="submit" name="search_submit" value='Suchen'>
</form>
我的控制器看起来像但不工作:
public function item($search=''){
if($search == '' && $this->input->post("search") != ""){
$search = urlencode($search);
header("Location:".site_url()."/search/item/$search");
}
$search = urldecode($search);
echo "suchen fur".$search;
}
如何使控制器通过诸如 mysite.com/search/item/search+text 之类的 url 获取搜索文本并显示结果?