Codeigniter路由器设置

时间:2013-03-18 05:24:54

标签: codeigniter codeigniter-2 router

我的网站在Codeigniter上运行。 我需要帮助来使用 router.php

来调整URI

目前我有这样的网址 -

http://www.mysite.com/search/use_advanced/true/from_tmstmp_deal_duration/1363581836/to_tmstmp_deal_duration/1371357836/

我想将其掩盖为 -

http://www.mysite.com/deals/

也就是说,当用户点击此网址时,它会像上面的长网址一样工作,但在浏览器地址栏中,它仍会显示http://www.mysite.com/deals/

注意:在长网址中,1363581836是当前的unix-timestamp,1371357836是90days未来的unix-timestamp。

在routes.php中

-

$route['default_controller'] = "frontend";
$route['scaffolding_trigger'] = "";
$route['deals'] =
"search/use_advanced/true/from_tmstmp_deal_duration/$1/to_tmstmp_deal_duration/$2/";
在frontend.module.php中 -

$route['deals/(.*)'] = array('title' => 'Deals','action' => 'search',);

1 个答案:

答案 0 :(得分:2)

为什么不在 routes.php

$route['deals/(:any)'] = "search/use_advanced/$1";