0

私は自分のウェブサイトに URI 言語識別子を持っています。codeigniter WIKI の指示に従って実行しました。それは正常に動作します。しかし、$this->uri->segment(2) == id および $this->uri->segment(1) == メソッドの名前であるため、コントローラーの名前を取得するにはどうすればよいですか?

これは私のroutes.phpです

$route['default_controller'] = "page";
$route['404_override'] = '';
$route['(\w{2})/(.*)'] = '$2';
$route['(\w{2})'] = $route['default_controller']; 

返信ありがとうございます。

4

1 に答える 1

1
$this->uri->segment(1) 

base_url() の後に ist パラメータを参照します

例えば

base url = 'http://localhost/site/'

URL http://localhost/site/controller/method

$this->uri->segment(1) = 'controller'
$this->uri->segment(2) = 'method'

以下のケースも確認してください

base url = 'http://testsite/test/site/'

URL http://testsite/test/site/controller/method

$this->uri->segment(1) = 'controller'
$this->uri->segment(2) = 'method'
于 2012-07-25T12:40:03.770 に答える