路由Codeigniter - 每个用户的唯一URL

问题描述:

I have a web application that I made in codeigniter. This system has multiple users. I wanted to give each user their unique URL so for example.

www.mysite.com/user1

www.mysite.com/user2

If the user visits the url below;

www.mysite.com/user2/admim/addArticle

admin/addArticle function should implement and ignore the user2 in the url. I looked into routing but I was not successful at solving this problem.

Is this possible?

What I tried so far:

I added following in routes.php file $route['(:any)'] = "home/index";

above did not work so I tried following guide at http://ellislab.com/forums/viewthread/217216/ which did not work either:

我有一个我在codeigniter中创建的Web应用程序。 该系统有多个用户。 我想给每个用户提供他们唯一的URL,例如。 p>

  www.mysite.com/user1

www.mysite.com/user2
  code>   pre> 
 
 

如果用户访问以下网址; p>

  www.mysite.com/user2/admim/addArticle
  code>   pre> 
 
 

admin / addArticle strong>函数应该实现并忽略url中的user2。 我查看了路由,但是我没有成功解决这个问题。 p>

这可能吗? p>

到目前为止我尝试了什么: p>

我在routes.php文件中添加了以下内容 $ route ['(:any)'] =“home / index”; p> 上面没有用,所以我尝试按照 http://ellislab.com/forums/viewthread/ 217216 / 也无效: p> div>

try:

$route['user(\d+)/admim/addArticle'] = "controller/action";

you can see some examples here routing