辅助函数
function E ($msg, $code=0) {
throw new Poscms\Model\Exception($msg, $code);
}
集成系统异常基类
namespace Poscms\Model;
/**
* CI框架系统异常基类
*/
class Exception extends \Exception {
}
调用方式:
try {
E('缺少UID', 200);
} catch (Exception $exception) {
ajaxReturn(['code' => $exception->getCode(), 'msg' => $exception->getMessage()]);
}