5
我试图将所有路由重定向到一个主控制器。这里是我的routes.php文件CodeIgniter URI路由(动态,多语言)
$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";
//$route['(\w{2})/(.*)'] = '$2';
//$route['(\w{2})'] = $route['default_controller'];
$route['(en|ge)/(:any)'] = $route['default_controller']."/index/$1";
$route['(:any)'] = $route['default_controller']."/index/$1";
我需要语言ID与每一个环节(如:http://site.com/en/hello-world)传递
这里是我的主控制器:
class Main extends Controller
{
function __construct()
{
parent::Controller();
}
function index($page_type=false, $param=false)
{
die($page_type.' | '.$param.'| Aaa!');
}
}
我想检查存在预定义的文件类型(如:http://site.com/en/archive/05-06-2010 - 此处预定义的类型将被存档),然后执行一些操作。如果没有,则在数据库中搜索slug。如果没有找到,那么去404.
问题是我无法获得索引函数参数($ page_type,$ param)。感谢帮助。