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