星辰大海 发表于 2014-3-4 16:18:33

本帖最后由 星辰大海 于 2014-3-4 16:19 编辑

Hex 发表于 2014-3-4 15:28 static/image/common/back.gif
确实不可以 exit,会有很多副作用,把 exit 换成 return 会比较合适。
_remap   可以了 谢谢

星辰大海 发表于 2014-3-4 16:20:59

Hex 发表于 2014-3-4 15:23 static/image/common/back.gif
控制器中不能使用 exit,必须使用 return,因为 CI 要在你的函数结束后做很多其他事情。

可以试试 _remap...

解决了谢谢 _remap


class Auth_Controller extends Hantech_Controller {
      
      public function __construct() {
                parent::__construct();
                $this->checkAuthInfo();
      }

      public function _remap($method)
      {

                if ($this->flag) {
                        $this->$method();
                } else {
                        if ($this->input->is_ajax_request()) {
                              echo json_encode();
                        } else {
                              $this->load->view('Public/Info');
                        }      
                }
      }

      /**
         * 验证用户登录 权限
         * @return
         */
      public function checkAuthInfo() {

                $this->load->library('auth');
                if ( !$this->auth->checkAuthInfo() ) {
                     $this->msg = $this->auth->getErrorInfo();
                     $this->flag = false;
                }
      }
}


李三 发表于 2014-3-4 16:58:30

星辰大海 发表于 2014-3-4 16:05 static/image/common/back.gif
错误不对 谢谢了

出什么错?我测试过的,用这种办法就可以输出内容的。
页: 1 [2]
查看完整版本: 帮忙帮下 流程问题 不知道要怎么处理 麻烦各位