Hex 发表于 2014-3-4 15:28 static/image/common/back.gif
确实不可以 exit,会有很多副作用,把 exit 换成 return 会比较合适。
_remap 可以了 谢谢
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:05 static/image/common/back.gif
错误不对 谢谢了
出什么错?我测试过的,用这种办法就可以输出内容的。
页:
1
[2]