3 回答

TA貢獻1757條經驗 獲得超8個贊
您的路由錯誤。無需路由url即可訪問$_GET
值。
嘗試下面的代碼。
更改$route['search?(:any)'] = "test/search?$1";
為$route['search'] = "test/search";
要獲得它的值:
$this->input->get('result');
$this->input->get('c');

TA貢獻1803條經驗 獲得超3個贊
您嘗試使用Get方法值(例如Url參數),請嘗試以下代碼
jQuery代碼
$(".submit").click(function(){
state = $("#state").val();
city = $(".city").val();
window.location.href="<?php echo base_url(); ?>search?state="+encodeURIComponent(state)+"&city="+encodeURIComponent(city);
});
路線
$route['search'] = "test/search";
控制器
public function search()
{
$state = $this->input->get('state');
$city = $this->input->get('city');
}
- 3 回答
- 0 關注
- 140 瀏覽
添加回答
舉報