简体   繁体   English

Codeigniter 3路由问题

[英]Codeigniter 3 Routing Issues

I have setup a route in the routes.php file like this: 我已经在routes.php文件中设置了一条路由,如下所示:

$route['videos/video'] = 'videos';

So if a user enters: 因此,如果用户输入:

http://domain.com/videos/video/

I want it to just load the videos page which works, but the issue I am running into is that it is keeping the URL the same so when the user clicks on one of the videos from the videos page the url will look like this: 我希望它仅加载可以正常工作的视频页面,但是我遇到的问题是它使URL保持不变,因此当用户单击视频页面中的一个视频时,URL如下所示:

http://domain.com/videos/video/video/1

When is should look like this: 什么时候应该是这样的:

http://domain.com/videos/video/1

Is there any way to change this behavior? 有什么办法可以改变这种行为?

Also, is there any way to hide the method in the URL? 另外,有什么方法可以在URL中隐藏该方法吗?

$route['videos/video'] = "videos/index";
$route['videos/video/(:num)'] = "videos/video/$1";

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

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