Files
cm-web-legacy/application/core/web/cm_exceptions.php
2020-06-10 06:19:03 +09:00

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;
}
}
}