[英]Route codeigniter url to another url segment
I'm unable to route the following URL to a specified URI segment in CodeIgniter. 我无法将以下URL路由到CodeIgniter中的指定URI段。
I want to route this URL 我想路由这个URL
http://192.168.10.225/bachan/view/wholesale_detail/test-property/155454
to: 至:
http://192.168.10.225/bachan/wholesale_detail/test-property/155454
in CodeIgniter 3x . 在CodeIgniter 3x中 。
I have implemented below code but it doesn't work as expected: 我已经实现了以下代码,但未按预期工作:
$route['wholesale_detail/(:any)']="wholesale_details/$1";
in routes.php
file. 在
routes.php
文件中。
Try this: 尝试这个:
$route['bachan/([a-z]+)/([a-z]+)/(:num)'] = 'bachan/view/$1/$2/$3';
In a route, the array key contains the URI to be matched, while the array value contains the destination it should be re-routed to. 在路由中,数组键包含要匹配的URI,而数组值包含应重新路由到的目标。 In the above example, if the literal word “bachan/wholesale_detail/test-property/123” is found in the the URL, the “bachan” class and the “view” method are instead used.
在上面的示例中,如果在URL中找到文字文字“ bachan / wholesale_detail / test-property / 123”,则改用“ bachan”类和“ view”方法。
用这个:
$route['bachan/wholesale_detail/test-property/(:any)'] = 'wholesale_details/$1';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.