當前位置: 首頁>>代碼示例>>PHP>>正文


PHP App::shutdown方法代碼示例

本文整理匯總了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();
    }
開發者ID:helpfulrobot,項目名稱:themonkeys-laravel-silverstripe,代碼行數:34,代碼來源:SilverstripeCommand.php


注:本文中的Illuminate\Support\Facades\App::shutdown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。