[英]Code igniter routing for dynamic id
How can I route to specific URL for URL having dynamic id. 如何将具有动态ID的URL路由到特定的URL。 Suppose orginal URL is
假设原始网址是
http:localhost/c2c/init/product/5 // here 5 is the id of the product.
In route.php 在route.php中
$route["product/iphone-on-sale"] = "init/product/5";
But its not routing to http:localhost/c2c/product/iphone-on-sale
when when original URL is entered. 但是,当输入原始URL时,它不会路由到
http:localhost/c2c/product/iphone-on-sale
。
You can try this 你可以试试这个
$route["product/iphone-on-sale/(:num)"] = "init/product/$1";
and your url will be 您的网址将是
http://localhost/c2c/product/iphone-on-sale/5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.