【发布时间】:2011-08-13 11:15:06
【问题描述】:
我想要一种动态路由形式。
基本上我想捕捉 404(通过 routes.php 404_override 完成)。
这很容易。
但是接下来我要做的是通过一系列检查。
例如 不要注意 is_xxx 函数不是来自任何地方的事实
$what = $this->uri->segment(1);
if(is_vanity_name($what)){
//now I want to route this to the profile controller and call the display function like so
//display('vanity', $what);
}
elseif(is_region_name($what)){
if(($deal = $this->uri->segment(2)) !== false){
//now I want to route to the deals controller can call the display function like so
//display($deal, $what);
}
else {
//now I want to route to the deals controller and call the daily function like so
//daily($what);
}
}
elseif(is_deal_name($what)){
//now I want to route to the deals controller and call the display function like so
//display($what);
}
else{
$this->load->view('errors/404');
}
这是一个非常基本的例子!
所以我的问题是, 一旦做出决定,我将如何重新路由到其他控制器?
【问题讨论】:
标签: php codeigniter controller routes