|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2014-3-4 16:20:59
|
显示全部楼层
Hex 发表于 2014-3-4 15:23 ![](static/image/common/back.gif)
控制器中不能使用 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;
}
}
}
复制代码
|
|