How to pass parameters in index function in codeigniter

后端 未结 12 1882
傲寒
傲寒 2020-12-14 03:02

here\'s an example of url: http://www.example.com/search/search-keyword

I am trying to make this work, I removed the index.php using .htaccess, search is the contro

12条回答
  •  不思量自难忘°
    2020-12-14 03:43

    I finally found a workaround since I cant simply put post variables into the URL.

    What I did was create another function, then redirect it to that function.

     class Search extends CI_Controller{
       function index(){
            $search_item = $this->input-post('search_item');
            redirect("search/q/".url_title($search_item));
      }
    
      function q($key){
        // process search
      }
     }
    

提交回复
热议问题