本文整理汇总了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'));
}
}