简体   繁体   English

如何在Codeigniter中设置路由?

[英]How to set up routing in codeigniter?

This is what I've in the config/routes.php 这就是我在config / routes.php中的内容

$route['music/artist/:any'] = "music/artist/index/$1"; $ route ['music / artist /:any'] =“音乐/艺术家/索引/ $ 1”;

And I've my controller, 'artist', inside a folder music/ 我将我的控制器“艺术家”放在音乐文件夹中

I tried to get the uri segment inside the index method from the artist controller but when I go to the browser with domain.com/music/artist/abc it returns page not found. 我试图从Artist控制器获取index方法内的uri分段,但是当我使用domain.com/music/artist/abc进入浏览器时,返回的页面未找到。

How can I make this work? 我该如何进行这项工作? But I want to have my controller inside that folder. 但是我想将控制器放在该文件夹中。

Any help will be great. 任何帮助都会很棒。 Thanks. 谢谢。

在config / routes.php中使用它

$route['music/artist/(:any)/(:any)'] = "music/artist/index/$1";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM