How to pass parameters in index function in codeigniter

后端 未结 12 1894
傲寒
傲寒 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:42

    I had to also check if some variable was passed or not - so here is the solution that I took.

    _index($parameter);
        }  
    
        public function _index($story_id) {        
            if($story_id == 'index'){
                //No variable passed
                redirect('auth', 'refresh');
            }else{
                $data['title'] = "Story";
                $this->load->view('story', $data);                
            }
        }
    
    }
    

    Hope this helps someone!

提交回复
热议问题