簡體   English   中英

動態ID的代碼點火器路由

[英]Code igniter routing for dynamic id

如何將具有動態ID的URL路由到特定的URL。 假設原始網址是

 http:localhost/c2c/init/product/5     // here 5 is the id of the product.

在route.php中

 $route["product/iphone-on-sale"] = "init/product/5";

但是,當輸入原始URL時,它不會路由到http:localhost/c2c/product/iphone-on-sale

你可以試試這個

$route["product/iphone-on-sale/(:num)"] = "init/product/$1";

您的網址將是

http://localhost/c2c/product/iphone-on-sale/5

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM