CI_Router::_set_default_controller PHP Method

_set_default_controller() protected method

Set default controller
protected _set_default_controller ( ) : void
return void
    protected function _set_default_controller()
    {
        if (empty($this->default_controller)) {
            show_error('Unable to determine what should be displayed. A default route has not been specified in the routing file.');
        }
        // Is the method being specified?
        if (sscanf($this->default_controller, '%[^/]/%s', $class, $method) !== 2) {
            $method = 'index';
        }
        if (!file_exists(APPPATH . 'controllers/' . $this->directory . ucfirst($class) . '.php')) {
            // This will trigger 404 later
            return;
        }
        $this->set_class($class);
        $this->set_method($method);
        // Assign routed segments, index starting from 1
        $this->uri->rsegments = array(1 => $class, 2 => $method);
        log_message('debug', 'No URI present. Default controller set.');
    }

Usage Example

コード例 #1
0
ファイル: Router.php プロジェクト: johnotaalo/zerotech
 public function _set_default_controller()
 {
     if (empty($this->directory)) {
         /* set the default controller module path */
         $this->_set_module_path($this->default_controller);
     }
     parent::_set_default_controller();
     if (empty($this->class)) {
         $this->_set_404override_controller();
     }
 }
All Usage Examples Of CI_Router::_set_default_controller