路由:codeigniter

时间:2017-11-07 14:56:07

标签: php codeigniter

我正在开发一个迷你电子商务系统。我有2个实体:1)用户; 2)管理员;我为我的标签使用了路由,这样我就不会显示控制器的名称和方法(如user / about)。

Scenaio:

I have 4 tabs, Home, Menu, Contact, About

当我点击菜单时,将显示所有菜单。网址看起来像这样,我用过:任何这条路线

project/order/menu(name of the selected menu)

但是当我再次点击任何这些标签时,它现在会给我一个错误,因为第3段仅适用于所选菜单

问题:我想做的是,我想阻止项目/订单/主页等。我只想要项目/订单/菜单。

情景:

I am in the menu. The available menu are: Bacon and Chicken
I chose the bacon, it will redirect to project/order/bacon. Then from that 
url I want to transfer to another page for example home. Instead of project/order/home it will look like this project/

路线

$route['order/(:any)'] = 'user/order/$1';

1 个答案:

答案 0 :(得分:0)

在/config/routes.php中,尝试添加

 $route['home'] = 'project/order/home';
 $route['contact'] = 'project/order/contact';
 $route['about'] = 'project/order/about';

上面

 $route['order/(:any)'] = 'user/order/$1';