本文整理匯總了PHP中AppKernel::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP AppKernel::getInstance方法的具體用法?PHP AppKernel::getInstance怎麽用?PHP AppKernel::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AppKernel
的用法示例。
在下文中一共展示了AppKernel::getInstance方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: define
<?php
define('SF_ROOT_DIR', realpath(dirname(__FILE__) . '/..'));
define('SF_APP', 'form');
define('SF_ENVIRONMENT', 'dev');
define('SF_DEBUG', true);
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php';
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'AppKernel.php';
AppKernel::getInstance()->getController()->dispatch();
示例2: initAppServiceContainer
public function initAppServiceContainer($container_class = 'AppServiceContainer')
{
$builder = new ContainerBuilder();
$configuration = AppKernel::getInstance()->getConfiguration();
$parameters = $configuration->parameters;
$parameters = $parameters->toArray();
$parameters = $builder->resolveValue($parameters, array('parameters' => $parameters));
$parameters = new Configuration($parameters);
$configuration->parameters = $parameters;
if (!isset($this->_serviceContainer)) {
$container_path = CACHE_ROOT . '/' . $container_class . '.php';
if (!file_exists($container_path) || ENV != 'online') {
$builder->setClassName($container_class);
$builder->setPath($container_path);
$builder->dump($this->getConfiguration());
}
require_once $container_path;
$this->_serviceContainer = call_user_func(array($container_class, 'getInstance'));
}
}