本文整理匯總了PHP中AppKernel::setCacheDir方法的典型用法代碼示例。如果您正苦於以下問題:PHP AppKernel::setCacheDir方法的具體用法?PHP AppKernel::setCacheDir怎麽用?PHP AppKernel::setCacheDir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AppKernel
的用法示例。
在下文中一共展示了AppKernel::setCacheDir方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: AppKernel
<?php
use Symfony\Component\ClassLoader\ApcClassLoader;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
$vagrantEnvironment = false;
if (file_exists('/vagrant/vagrant/php/vagrantEnvironment.php')) {
$vagrantEnvironment = (include '/vagrant/vagrant/php/vagrantEnvironment.php');
}
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
require_once __DIR__ . '/../app/AppKernel.php';
if ($vagrantEnvironment && $vagrantEnvironment['isDevelopmentEnvironment']) {
Debug::enable();
$kernel = new AppKernel('dev', true);
$kernel->setCacheDir($vagrantEnvironment['symfonyCacheDirectory']);
$kernel->setLogDir($vagrantEnvironment['symfonyLogsDirectory']);
$kernel->loadClassCache();
} else {
$apcLoader = new ApcClassLoader('backend', $loader);
$loader->unregister();
$apcLoader->register(true);
require_once __DIR__ . '/../app/AppCache.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$kernel = new AppCache($kernel);
}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);