本文整理汇总了PHP中Symfony\Component\HttpKernel\Kernel::getEnvParameters方法的典型用法代码示例。如果您正苦于以下问题:PHP Kernel::getEnvParameters方法的具体用法?PHP Kernel::getEnvParameters怎么用?PHP Kernel::getEnvParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Symfony\Component\HttpKernel\Kernel
的用法示例。
在下文中一共展示了Kernel::getEnvParameters方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getEnvParameters
/**
* Injecting the owner's name of this Kernel file to add an "env parameter"
* Note : This mechanism is only avalaible in DEV because it is only intended
* in development environment. With this parameter, you can customize any
* parameter of config_dev.yml with the shortcut %developer.name%
*
* This is very convenient when you have many developers on one common
* development POSIX server. There is a fallback for Windows.
*
* @return array
*/
protected function getEnvParameters()
{
$base = parent::getEnvParameters();
// owner of source
if ('dev' == $this->getEnvironment()) {
$base['developer.name'] = 'dev';
if (function_exists('posix_getpwuid')) {
$owner = posix_getpwuid(fileowner(__FILE__));
if (array_key_exists('name', $owner)) {
$base['developer.name'] = $owner['name'];
}
}
}
return $base;
}
示例2: getEnvParameters
/**
* Gets the environment parameters.
*
* Only the parameters starting with "ZIKULA__" are considered.
*
* @return array An array of parameters
*/
protected function getEnvParameters()
{
$parameters = parent::getEnvParameters();
foreach ($_SERVER as $key => $value) {
if (0 === strpos($key, 'ZIKULA__')) {
$parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value;
}
}
return $parameters;
}