Codeigniter retrieve rewritten URL parameters

ralph_solaris

I'm using Codeigniter and my page URL is here.

and I want to send this URL to the controller "adverts" and method "search" with a category parameter "cat" and id "824". To do so i use the routes like this:

$route['^en/hotels$'] = "adverts/search/cat/824";

My problem now is that i dont know how to retrieve the rewritten parameters "cat" and id "824". When i use $this->uri->segment_array() i have the initial request URL:

array (size=2) 
  1 => string 'en' (length=2) 
  2 => string 'hotels' (length=16)

Please someone can explain me how to retrieve my parameters?

Thanks again.

Adeel

you should declare a method like:

function search($cat,$id){

}

CodeIgniter will automatically bind URL parameters to method parameters.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事