コード例 #1
0
ファイル: ErrorHandler.php プロジェクト: slince/application
    /**
     * 获取404错误对应的错误内容
     * @param Kernel $kernel
     * @param Application $application
     * @param array $parameters
     * @return string
     */
    protected function getNotFoundContent(Kernel $kernel, Application $application = null, array $parameters = [])
    {
        if (!is_null($application)) {
            $content = $this->renderContentFromView($application, '404', $parameters);
        } else {
            $content = <<<EOT
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL {$kernel->getParameter('request')->getPathInfo()} was not found on this server.</p>
</body></html>
EOT;
        }
        return $content;
    }