0

我的网站在 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/

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

注意:在长 url 中,1363581836 是当前的 unix 时间戳,1371357836 是未来 90 天的 unix 时间戳。

在 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',);
4

1 回答 1

2

为什么不在routes.php中这样做:

$route['deals/(:any)'] = "search/use_advanced/$1";
于 2013-03-23T11:38:51.477 回答