开发者

Changing default route after a user is logged in

开发者 https://www.devze.com 2023-04-07 23:17 出处:网络
How do I change the default route after a user is logged in? I\'m using the Cod开发者_JS百科eIgniter framework.Rather than changing the default route, you could simply have your controller act differe

How do I change the default route after a user is logged in? I'm using the Cod开发者_JS百科eIgniter framework.


Rather than changing the default route, you could simply have your controller act differently if they are logged in. Something like:

class Welcome extends CI_Controller {
  public function index()
  {
    if($logged_in) {
      $this->load->view('authenticated');
    } else {
      $this->load->view('guest');
    }
  }
}


You can change the default route with

$route['default_controller'] = 'route'; 

in application/config/routes.php

0

精彩评论

暂无评论...
验证码 换一张
取 消