用户
 找回密码
 入住 CI 中国社区
搜索
12
返回列表 发新帖
楼主: 星辰大海
收起左侧

[版本 2.x] 帮忙帮下 流程问题 不知道要怎么处理 麻烦各位

[复制链接]
 楼主| 发表于 2014-3-4 16:18:33 | 显示全部楼层
本帖最后由 星辰大海 于 2014-3-4 16:19 编辑
Hex 发表于 2014-3-4 15:28
确实不可以 exit,会有很多副作用,把 exit 换成 return 会比较合适。

_remap   可以了 谢谢

 楼主| 发表于 2014-3-4 16:20:59 | 显示全部楼层
Hex 发表于 2014-3-4 15:23
控制器中不能使用 exit,必须使用 return,因为 CI 要在你的函数结束后做很多其他事情。

可以试试 _remap  ...

解决了  谢谢 _remap

PHP复制代码
 
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 [type] [description]
         */

        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
错误  不对 谢谢了

出什么错?我测试过的,用这种办法就可以输出内容的。

本版积分规则