first commit
This commit is contained in:
24
application/core/web/cm_exceptions.php
Executable file
24
application/core/web/cm_exceptions.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<? 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user