如何在Codeigniter中修改路由 [英] how to modify routes in codeigniter

查看:85
本文介绍了如何在Codeigniter中修改路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮我解决这个问题。

举个例子:我有这个普通的URL
localhost / CI / index.php / base / storeurl。

Take example: I have this normal url "localhost/CI/index.php/base/storeurl".

如何让Codeigniter知道寻找
localhost / CI / storeurl。

How can I let Codeigniter know to look for "localhost/CI/storeurl".

我有一个名为index的函数,它在Base.php类中接受参数storeURL。帮帮我

I have a function named index and it accepts a parameter storeURL in the Base.php class. Help me with this. Thanks in advance.

推荐答案

我终于找到了想要的东西。这是我的代码在routes.php中的样子。

I've finally found what I was looking for. Here is how my code looks like in routes.php.

/* Custom Routes. */
// Store Normal Pages.
$route['home/(:any)'] = "base/home/$1";
$route['about/(:any)'] = "base/about/$1";
$route['services/(:any)'] = "base/services/$1";
$route['contact/(:any)'] = "base/contact/$1";
$route['feedback/(:any)'] = "base/feedback/$1";

// CategoryPage.
$route['category/(:any)/(:num)'] = "base/category/$1/$2";
// ProductPage.
$route['product/(:any)/(:num)'] = "base/product/$1/$2";


// For Main Home Page.
$route['(:any)'] = "base/home/$1";

我真的很感谢帮助我解决此问题的每个人。感谢大伙们。

I really Appreciate everyone who helped me solving this problem. Thank You Guys.

这篇关于如何在Codeigniter中修改路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆