本文整理匯總了PHP中Illuminate\Support\Facades\App::shutdown方法的典型用法代碼示例。如果您正苦於以下問題:PHP App::shutdown方法的具體用法?PHP App::shutdown怎麽用?PHP App::shutdown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\App
的用法示例。
在下文中一共展示了App::shutdown方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: bootSilverstripe
protected function bootSilverstripe($url = null)
{
$flush = $this->option('flush');
// to allow the Silverstripe command line to know what the server URL should be ...
// sadly, setting a global $_FILE_TO_URL_MAPPING variable is not enough because Silverstripe's Core.php (or
// Constants.php in newer versions) doesn't declare it as global - it assumes it's declared in the
// _ss_environment.php file which is _included_ not _required_. Boo.
// global $_FILE_TO_URL_MAPPING;
// $_FILE_TO_URL_MAPPING[base_path()] = Config::get('app.url');
$base = base_path();
$envPath = $base . '/_ss_environment.php';
if (!file_exists($envPath)) {
$appUrl = Config::get('app.url');
file_put_contents($envPath, <<<EOT
<?php
global \$_FILE_TO_URL_MAPPING;
\$_FILE_TO_URL_MAPPING['{$base}'] = '{$appUrl}';
EOT
);
App::shutdown(function ($app) use($envPath) {
unlink($envPath);
});
}
// taken from silverstripe's framework/cli-script.php
if ($flush) {
$_REQUEST['flush'] = $flush === true ? 1 : $flush;
$_GET['flush'] = $flush === true ? 1 : $flush;
}
if ($url) {
$_REQUEST['url'] = $url;
$_GET['url'] = $url;
}
Silverstripe::start();
}