25 lines
583 B
PHP
Executable File
25 lines
583 B
PHP
Executable File
<? if ( ! defined('BASEPATH')) exit('No direct script access allowed');
|
|
|
|
class Cm_Exception extends Exception {
|
|
|
|
public function __construct($type, $code, $msg) {
|
|
|
|
if($type=='json') {
|
|
header("Content-Type: application/json");
|
|
|
|
$arr = array();
|
|
$arr = array('code' => $code, 'msg' => $msg);
|
|
|
|
echo json_encode($arr);
|
|
exit;
|
|
} else if($type=='html') {
|
|
header("Content-Type: text/html; charset=UTF-8");
|
|
echo $code.'|||||'.$msg;
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|