Routes in Codeigniter - Automatically

后端 未结 4 1893
自闭症患者
自闭症患者 2020-12-03 19:06

I have a problem with Codeigniter routes. I would like to all registered users on my site gets its own \"directory\", for example: www.example.com/username1,

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-03 19:21

    Another way would be declaring an array with your intenal controllers and redirect everything else to the user controller like this in your routes.php file from codeigniter:

    $controllers=array('admin', 'user', 'blog', 'api');
    if(array_search($this->uri->segment(1), $controllers)){
        $route['.*'] = "polica/ogled/$1";
    }
    

提交回复
热议问题