返回标准输出json
@param null $data
@param string $msg
@param int $code
@return string
486375
public static function outputJson($data = null, $msg = '', $code = 0)
    {
        if (!$code) {
            return [
                'code' => 0,
                'msg' => $msg,
                'data' => $data,
            ];
        } else {
            return [
                'code' => $code,
                'msg' => $msg ? $msg : '未知错误',
            ];
        }
    }
526840
public function outputJson($data = null, $message = '', $status = 200)
    {
        // 错误信息返回格式可参考：[https://developer.github.com/v3/]
        if ($status != 200 && $message !== '') {
            $data = [
                'message' => $message
            ];
        }
        parent::outputJson($data, $status);
    }
719941
public static function getMessage( $code, $lang = 'EN' ) {
    if( $code < 0 ) {
      return null;
    } //code invalid

    $lang = strtoupper( $lang );

    if( !array_key_exists( $lang, self::$code ) ) { //language not found
      $lang = 'EN';
    }

    if( array_key_exists( $code, self::$code[$lang] ) ) { //code not defined
      return self::$code[$lang][$code];
    }

    return null;
  }
996176
public static function output($message, $data = [], $code = 0)
    {
        header('Content-Type:text/html;Charset=' . APP_CHARSET);
        $output = [
            'code' => $code,
            'message' => $message,
            'data' => $data,
        ];
        if (isset($_GET['e_callback']) && $_GET['e_callback']) {
            echo $_GET['e_callback'] . '(' . json_encode($output) . ')';
        } else {
            if (!headers_sent()) header('Content-type: application/json');
            echo json_encode($output);
        }
    }
709493
public function successData($data, $msg = null, $extraData = [])
    {
        $return = $this->output(1, $msg, $data, $extraData);

        return $this->responseJson($return);
    }
686461
public function output($code, $msg = null, $data = null, $extraData = [])
    {
        if (is_null($msg)) {
            $msg = '未知';
        }

        $return = [
            'success' => (boolean)$code,
            'msg' => $msg,
        ];
        if ($extraData) {
            $return = array_merge($return, $extraData);
        }
        if (!is_null($data)) {
            $return['data'] = $data;
        }

        return $this->responseJson($return);
    }
844217
public function success($data = null, $statusCode = null, array $meta = []):JsonResponse
    {
        if (is_integer($data)) {
            list($data, $statusCode, $meta) = [null, $data, is_array($statusCode) ? $statusCode : []];
        }

        if (is_array($statusCode)) {
            list($statusCode, $meta) = [200, $statusCode];
        }

        return $this->successResponse->transform($data)->addMeta($meta)->respond($statusCode);
    }
448024
public function respondCreated($code = ApiResponse::CODE_SUCCESS, array $data = [], $message = null): JsonResponse
    {
        return $this->setStatusCode(IlluminateResponse::HTTP_CREATED)->respond([
            'status' => [
                'type' => 'success',
                'message' => $this->getDefaultMessage($code, $message),
                'code' => $code,
                'http_code' => $this->getStatusCode(),
            ],
            'data' => $data,
        ]);
    }
590689
public function json($code,$message='',$data=[])
    {
        header('Content-type:application/json');
        if(is_array($code)){
            echo json_encode($code);
        }else{
            echo json_encode(['code'=>$code,'message'=>$message,'result'=>$data]);
        }
        exit;
    }
956509
public function error( $code = 404, $msg = "Resource not found" )
	{
		$request = HttpFactory::i()->request();

		if ( $request->ajax() || $request->wantsJson() )
			return new JsonResponse( ['error' => $msg] );
		else
			return new Response( Redirect::back()->withInput( $request->input() )->withErrors( ['error' => $msg] ) );
	}
1279172
public function outputJson($data = null, $status = 200)
    {
        $this->getContext()->getOutput()->outputJson($data, $status);
    }
512954
public function info($msg, $data = NULL) {
        if (!$this->isAllowToLog(static::LOG_LEVEL_INFO)) {
            return;
        }

        $this->log('info', $msg, $data);
    }
927542
public static function codeResponse($code,$message)
    {
        $code = intval($code);

        foreach(self::$results as $v) {
            if ($v['message'] == $message && $v['code'] == $code)
                return $v;
        }

        return null;
    }
112971
public function json(array $array = [], int $code = null)
  {
    $this->data = $array;

    if ($code != null) {
      $this->code = $code;
      header('HTTP/1.1 '.$this->code);
      return $this->send();
    }

    return $this;
  }
245978
public function respondWithFailure($code = null, array $data = [], $message = null): JsonResponse
    {
        return $this->setStatusCode(IlluminateResponse::HTTP_BAD_REQUEST)->respond([
            'status' => [
                'type' => 'error',
                'message' => $this->getDefaultMessage($code, $message),
                'code' => $code,
                'http_code' => $this->getStatusCode(),
            ],
            'data' => $data,
        ]);
    }
1052718
private function sendResponse($code, $message, $response = null) {
        $ret = [
            'code' => $code,
            'message' => $message,
        ];
        if ($response) {
            $ret['response'] = $response;
        }
        return $ret;
    }
1333585
function json($data = '', $code = 0, $message = '')
    {
        $json = array('code' => $code, 'message' => $message, 'data' => $data);
        if (!empty($_REQUEST['jsonp']))
        {
            $this->http->header('Content-type', 'application/x-javascript');
            return $_REQUEST['jsonp'] . "(" . json_encode($json) . ");";
        }
        else
        {
            $this->http->header('Content-type', 'application/json');
            return json_encode($json);
        }
    }