Codeigniter路由无法正常工作

时间:2017-02-09 15:39:41

标签: php codeigniter routes

你好,我需要路由

/tagi/fotografia,51//galeria-sztuki-nowosci/?tags=51

这只是ofc的例子。我在routes.php中的代码是:

$route['tagi/(:any),(\d+)'] = function($id) {
    return 'galeria-sztuki-nowosci/?tags=$id';
};

它没有用。

1 个答案:

答案 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");
}

完成

相关问题