直接输出模板信息
@param string $tpl 模板地址
@param array $data 传递给模板的数据
@param int $status 状态码，默认会输出200
437254
public function render($tpl, array $data = [], $status = null)
    {
        if ($this->view === null) {
            $this->view = $this->view();
        }
        if ($status !== null) {
            $this->res->setStatus($status)->send();
        }
        $this->view->display($tpl, $data);
    }
1297234
public function display($tpl = '')
    {
        if (Container::get('request')->isCli()) {
            throw new ResponseException('cannot render template in CLI mode');
        }

        if ('' === $tpl) {
            $tpl = Container::get('route')->getController() . '/'
            . Container::get('route')->getAction();
        }

        $this->viewPath = $this->tplDir . $tpl . '.html';
        if (!Helper::isFile($this->viewPath)) {
            throw new NotFoundException('Template is not existed.');
        }

        unset($tpl);
        ob_start();
        extract($this->data, EXTR_OVERWRITE);
        include $this->viewPath;
        $buffer = ob_get_contents();
        ob_get_clean();
        $output = Helper::comment() . preg_replace('|</body>.*?</html>|is', '', $buffer, -1, $count) . Container::get('trace')->showTrace();
        if ($count > 0) {
            $output .= '</body></html>';
        }

        echo $output;
    }
342460
public function post($resource, $data = [])
    {
        $exec = $this->execute(Method::$HTTP_POST, $resource, ['json' => $data]);

        return $exec;
    }
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);
    }
241917
public function json($status_code, $message, $data = null)
    {
        return response()->json([
                                    'status_code' => $status_code,
                                    'message'     => $message,
                                    'data'        => $data,
                                    'request'     => \request()->all(),
                                ]);
    }
234118
public function resourceJson($data = array(), $status = 200, array $headers = array())
  {
    $headers = array_merge($headers, $this->getRequestLimitHeader());
    $headers = array_merge($headers, $this->getConfig('headers'));

    return $this->getResponse()->resourceJson($data, $status, $headers);
  }
871226
static function operatorStaticData( $tpl, $operatorName )
    {
        if ( is_array( $tpl->Operators[$operatorName] ) )
        {
            $tpl->loadAndRegisterOperators( $tpl->Operators[$operatorName] );
        }
        $operatorObject =& $tpl->Operators[$operatorName];
        $operatorData = null;
        if ( is_object( $operatorObject ) )
        {
            if ( method_exists( $operatorObject, 'operatorCompiledStaticData' ) )
            {
                $operatorData = $operatorObject->operatorCompiledStaticData( $operatorName );
            }
        }
        else if ( $tpl->testCompile() )
        {
            $tpl->warning( '', "Operator '$operatorName' is not registered." );
        }

        return $operatorData;
    }
561561
public static function getQueryTemplateArray($tpl, array $arguments)
    {
        $argNum = count($arguments);
        for ($i = $argNum; $i > 0; $i--) {
            $tpl = str_replace('%' . $i, $arguments[$i - 1], $tpl);
        }

        return $tpl;
    }
19261
public function setTemplate($tpl, $clearParams=true)
    {
        if ($clearParams) {
            $this->clearParams();
        }
        $this->templateFile = $this->templatesPath.$tpl.'.tpl.php';
    }
779352
public static function json($data, $status = NULL) {
        if ($status) {
            parent::setStatus($status);
        }
        parent::setContentType('application/json');
        return json_encode($data);
    }
1287730
protected function _setTpl($tpl)
    {
        $this->_tpl = $tpl;

        if ($tpl === true) {
            $this->_tpl = self::TPL_WRAP;
        }

        if ($tpl === false) {
            $this->_tpl = self::TPL_DEFAULT;
        }
    }
418672
protected function renderTpl($tpl, $data = array())
    {
        if (!empty($tpl)) {
            extract($data);
            ob_start();
            eval('?>'.$tpl.'<?php ');
            $tpl = ob_get_clean();
        }

        return $tpl;
    }
1289552
public function success(int $statusCode, string $message, $data = null): JsonResponse
    {

        $this->setStatusCode($statusCode);

        $this->setMessage($message);

        $this->setData($data);


        $content['message'] = $this->getMessage();


        if (null !== $this->getCode()) {
            $content['code'] = $this->getCode();
        }


        $content['status_code'] = $this->getStatusCode();


        if (null !== $this->getData() && $this->getErrors() !== $this->getData()) {
            $content['data'] = $this->getData();
        }

        if (null !== $this->getErrors()) {
            $content['errors'] = $this->getErrors();
        }

        $content += $this->Hypermedia;

        return new JsonResponse($content, $this->getHttpStatusCode() ?: $this->getStatusCode());
    }
1231096
public function streamXml(array $data = [], $status = 200, array $config = []): SymfonyResponse
    {
        return Response::stream($this->createXmlResponse($data, $config), $status, [
            'Content-Type' => 'text/xml',
        ]);
    }
1279172
public function outputJson($data = null, $status = 200)
    {
        $this->getContext()->getOutput()->outputJson($data, $status);
    }
909600
public function renderPage($data, $status = 200)
    {
        // creates the views with viewify function
        array_key_exists("views", $data) && $this->viewify($data["views"]);

        $data["stylesheets"] = ["css/style.css"];
        $data["javascripts"] = ["js/index.js"];


        if ($data["title"] !== null) {
            return $data["title"];
        }
        return false;
    }
792069
public function json($data, $status = HttpMessage::HTTP_OK, $encodingOptions = 0)
    {
        $json = json_encode($data, $encodingOptions);
        $this->withStatusCode($status)
            ->withHeader('content-type', 'application/json')
            ->getBody()->write($json);
        return $this;
    }