本文整理汇总了PHP中AppKernel::setDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP AppKernel::setDomain方法的具体用法?PHP AppKernel::setDomain怎么用?PHP AppKernel::setDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppKernel
的用法示例。
在下文中一共展示了AppKernel::setDomain方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1')) || php_sapi_name() === 'cli-server')) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.');
}
// $loader = require_once __DIR__.'/../app/bootstrap.php.cache';
$loader = (require_once __DIR__ . '/../app/autoload.php');
Debug::enable();
require_once __DIR__ . '/../app/AppKernel.php';
$request = Request::createFromGlobals();
$kernel = new AppKernel('dev', true);
$kernel->setDomain($request->getHttpHost());
//$kernel->loadClassCache();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);