你好,我需要路由
/tagi/fotografia,51/
至/galeria-sztuki-nowosci/?tags=51
这只是ofc的例子。我在routes.php中的代码是:
$route['tagi/(:any),(\d+)'] = function($id) {
return 'galeria-sztuki-nowosci/?tags=$id';
};
它没有用。
答案 0 :(得分:1)
首先,需要在config.php中添加逗号
$ config [' permits_uri_chars'] =' a-z 0-9~%。:_ - ,';
下一个routes.php将是
$ route [" tagi /([a-z] +),(:any)"] =' old / galleryTags / $ 2';
最后需要用
做控制器公共功能galleryTags($ tags) {
if ($tags == "_"): $tags = ""; endif;
header("Location: /galeria-sztuki-nowosci/?tags=$tags");
}
完成