本文整理汇总了PHP中App\Http\Controllers\App::Environment方法的典型用法代码示例。如果您正苦于以下问题:PHP App::Environment方法的具体用法?PHP App::Environment怎么用?PHP App::Environment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Controllers\App
的用法示例。
在下文中一共展示了App::Environment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSetupIndex
/**
* Checks to see whether or not the database has a migrations table
* and a user, otherwise display the setup view.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v3.0]
* @return View
*/
public function getSetupIndex()
{
try {
$conn = DB::select('select 2 + 2');
$start_settings['db_conn'] = true;
$start_settings['db_name'] = DB::connection()->getDatabaseName();
$start_settings['db_error'] = null;
} catch (\PDOException $e) {
$start_settings['db_conn'] = false;
$start_settings['db_name'] = config('database.connections.mysql.database');
$start_settings['db_error'] = $e->getMessage();
}
$protocol = array_key_exists('HTTPS', $_SERVER) && $_SERVER['HTTPS'] == "on" ? 'https://' : 'http://';
$pageURL = $protocol;
if ($_SERVER["SERVER_PORT"] != "80") {
$main_page = $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"];
$pageURL .= $main_page . $_SERVER["REQUEST_URI"];
} else {
$main_page = $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
$pageURL .= $main_page;
}
$start_settings['env_location'] = $pageURL . '../.env';
if (config('app.url') . '/setup' != $pageURL) {
$start_settings['url_valid'] = false;
} else {
$start_settings['url_valid'] = true;
}
$start_settings['url_config'] = config('app.url');
$start_settings['real_url'] = $pageURL;
$exposed_env = @file_get_contents($main_page . '/.env');
if ($exposed_env) {
$start_settings['env_exposed'] = true;
} else {
$start_settings['env_exposed'] = false;
}
if (\App::Environment('production') && config('app.debug') == true) {
$start_settings['debug_exposed'] = true;
} else {
$start_settings['debug_exposed'] = false;
}
$environment = app()->environment();
if ($environment != 'production') {
$start_settings['env'] = $environment;
$start_settings['prod'] = false;
} else {
$start_settings['env'] = $environment;
$start_settings['prod'] = true;
}
if (function_exists('posix_getpwuid')) {
// Probably Linux
$owner = posix_getpwuid(fileowner($_SERVER["SCRIPT_FILENAME"]));
$start_settings['owner'] = $owner['name'];
} else {
// Windows
// TODO: Is there a way of knowing if a windows user has elevated permissions
// This just gets the user name, which likely isn't 'root'
// $start_settings['owner'] = getenv('USERNAME');
$start_settings['owner'] = '';
}
if ($start_settings['owner'] === 'root' || $start_settings['owner'] === '0') {
$start_settings['owner_is_admin'] = true;
} else {
$start_settings['owner_is_admin'] = false;
}
if (is_writable(storage_path()) && is_writable(storage_path() . '/framework') && is_writable(storage_path() . '/framework/cache') && is_writable(storage_path() . '/framework/sessions') && is_writable(storage_path() . '/framework/views') && is_writable(storage_path() . '/logs')) {
$start_settings['writable'] = true;
} else {
$start_settings['writable'] = false;
}
$start_settings['gd'] = extension_loaded('gd');
return View::make('setup/index')->with('step', 1)->with('start_settings', $start_settings)->with('section', 'Pre-Flight Check');
}