Exemplo n.º 1
0
 public static function json_error($msg = '')
 {
     $params = json_encode(Input::all());
     $str = $msg . ' ' . $params;
     Requests::log($str);
     $err = new stdClass();
     $err->status = 'error';
     $err->message = trim($msg);
     if (isset($_GET['jsoncallback'])) {
         header('Content-Type:text/html;Charset=utf-8');
         echo $_GET['jsoncallback'] . "(" . json_encode($err) . ")";
         exit;
     } else {
         header('Content-Type: application/json');
         $retval = json_encode($err);
         echo $retval;
         exit;
     }
 }