Example #1
0
    /**
     * 获取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;
    }
Example #2
0
 /**
  * 初始化application
  */
 protected function initialize()
 {
     $this->registerConfigs($this->kernel->getContainer()->get('config'));
     $this->registerServices($this->kernel->getContainer());
     $this->registerSubscribers($this->kernel->getContainer()->get('dispatcher'));
 }
Example #3
0
 function __construct()
 {
     parent::__construct();
     $this->router = Kernel::instance()->getRouter();
 }