Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 动态id的代码点火器路由_Php_Url Routing_Codeigniter Routing - Fatal编程技术网

Php 动态id的代码点火器路由

Php 动态id的代码点火器路由,php,url-routing,codeigniter-routing,Php,Url Routing,Codeigniter Routing,如何为具有动态id的URL路由到特定URL。假设原始URL为 http:localhost/c2c/init/product/5 // here 5 is the id of the product. 在route.php中 但当输入原始URL时,它不会路由到http:localhost/c2c/product/iphone on sale。您可以尝试此方法 $route["product/iphone-on-sale/(:num)"] = "init/product/$1"; 您

如何为具有动态id的URL路由到特定URL。假设原始URL为

 http:localhost/c2c/init/product/5     // here 5 is the id of the product.
在route.php中

但当输入原始URL时,它不会路由到http:localhost/c2c/product/iphone on sale。

您可以尝试此方法

$route["product/iphone-on-sale/(:num)"] = "init/product/$1";
您的url将是

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