本文整理匯總了PHP中Illuminate\Contracts\Foundation\Application::detectEnvironment方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::detectEnvironment方法的具體用法?PHP Application::detectEnvironment怎麽用?PHP Application::detectEnvironment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Contracts\Foundation\Application
的用法示例。
在下文中一共展示了Application::detectEnvironment方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: bootstrap
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function bootstrap(Application $app)
{
if (file_exists($app['path.base'] . '/.env')) {
Dotenv::load($app['path.base']);
}
$app->detectEnvironment(function () {
return getenv('APP_ENV') ?: 'production';
});
}
示例2: bootstrap
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @return void
*/
public function bootstrap(Application $app)
{
try {
Dotenv::load($app->environmentPath(), $app->environmentFile());
} catch (InvalidArgumentException $e) {
//
}
$app->detectEnvironment(function () {
return env('APP_ENV', 'production');
});
}
示例3: bootstrap
/**
* Bootstrap the given application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
*
* @return void
*/
public function bootstrap(Application $app)
{
$app->detectEnvironment(function () {
return env('APP_ENV', 'production');
});
if (!$app->configurationIsCached()) {
try {
(new Dotenv($app->environmentPath(), $app->environmentFile()))->load();
} catch (InvalidPathException $e) {
//
}
}
}
示例4: bootstrap
/**
* Bootstrap the given application.
*
* @param Application $app
*/
public function bootstrap(Application $app)
{
// Attempt to load the default .env
try {
Dotenv::load($app->environmentPath(), $app->environmentFile());
} catch (InvalidArgumentException $e) {
//
}
// Attempt to load the environment-specific .env
try {
Dotenv::load($app->environmentPath(), vsprintf('.%s.env', [env('APP_ENV', static::DEFAULT_ENVIRONMENT)]));
} catch (InvalidArgumentException $e) {
//
}
$app->detectEnvironment(function () {
return env('APP_ENV', static::DEFAULT_ENVIRONMENT);
});
}
示例5: bootstrap
public function bootstrap(Application $app)
{
$app->detectEnvironment(function () {
return isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (stripos(PHP_OS, 'darwin') === false ? 'production' : 'local');
});
}