当前位置: 首页>>代码示例>>PHP>>正文


PHP ServerBag::get方法代码示例

本文整理汇总了PHP中Symfony\Component\HttpFoundation\ServerBag::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ServerBag::get方法的具体用法?PHP ServerBag::get怎么用?PHP ServerBag::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\HttpFoundation\ServerBag的用法示例。


在下文中一共展示了ServerBag::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 /**
  * @param string $filePath
  * @param \Symfony\Component\HttpFoundation\ServerBag $server
  *
  * @return bool
  */
 private function authenticate($filePath, ServerBag $server)
 {
     $passFile = $this->kernel->getRootDir() . '/../web/var/export/' . substr($filePath, 0, strrpos($filePath, '/')) . '/.htpasswd';
     list($auth['user'], $auth['pass']) = explode(':', file_get_contents($passFile));
     $user = $server->get('PHP_AUTH_USER');
     $pass = crypt($server->get('PHP_AUTH_PW'), md5($server->get('PHP_AUTH_PW')));
     return $user == $auth['user'] && $pass == $auth['pass'];
 }
开发者ID:kamilmusial,项目名称:EzSystemsRecommendationBundle,代码行数:14,代码来源:ExportController.php

示例2:

 function it_does_not_provides_server_version_of_pim_host_if_request_is_null($requestStack, $versionProvider, ServerBag $serverBag)
 {
     $versionProvider->getPatch()->willReturn('1.4.0');
     $versionProvider->getEdition()->willReturn('CE');
     $requestStack->getCurrentRequest()->willReturn(null);
     $serverBag->get(Argument::type('string'))->shouldNotBeCalled();
     $this->collect()->shouldReturn(['pim_edition' => 'CE', 'pim_version' => '1.4.0', 'pim_environment' => 'prod', 'pim_install_time' => '2015-09-16T10:10:32+02:00', 'server_version' => '']);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:8,代码来源:VersionDataCollectorSpec.php

示例3: get

 /**
  * Method to get the system information
  *
  * @return string[]
  */
 public function get()
 {
     $server = new ServerBag($GLOBALS['_SERVER']);
     $info = [];
     $info['php'] = php_uname();
     if ($pdo = App::db()->getWrappedConnection() and $pdo instanceof PDOConnection) {
         $info['dbdriver'] = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
         $info['dbversion'] = $pdo->getAttribute(\PDO::ATTR_SERVER_VERSION);
         $info['dbclient'] = $pdo->getAttribute(\PDO::ATTR_CLIENT_VERSION);
     }
     $info['phpversion'] = phpversion();
     $info['server'] = $server->get('SERVER_SOFTWARE', getenv('SERVER_SOFTWARE'));
     $info['sapi_name'] = php_sapi_name();
     $info['version'] = App::version();
     $info['useragent'] = $server->get('HTTP_USER_AGENT');
     $info['extensions'] = implode(", ", get_loaded_extensions());
     $info['directories'] = $this->getDirectories();
     return $info;
 }
开发者ID:LibraryOfLawrence,项目名称:pagekit,代码行数:24,代码来源:InfoHelper.php

示例4: parseAcceptLanguage

 /**
  * Parst den ACCEPT-LANGUAGE Header des Browsers
  * und gibt die präferierten Sprachen zurück
  *
  * @return array
  */
 public function parseAcceptLanguage()
 {
     $locales = [];
     if ($this->server->has('HTTP_ACCEPT_LANGUAGE')) {
         $matches = [];
         preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\\s*(;\\s*q\\s*=\\s*(1|0\\.[0-9]+))?/i', $this->server->get('HTTP_ACCEPT_LANGUAGE'), $matches);
         if (!empty($matches[1])) {
             $locales = array_combine($matches[1], $matches[4]);
             // Für Einträge ohne q-Faktor, Wert auf 1 setzen
             foreach ($locales as $locale => $val) {
                 if ($val === '') {
                     $locales[$locale] = 1;
                 }
             }
             // Liste nach Sprachpräferenz sortieren
             arsort($locales, SORT_NUMERIC);
         }
     }
     return $locales;
 }
开发者ID:acp3,项目名称:core,代码行数:26,代码来源:UserAgent.php

示例5: prepareBasePath

 /**
  * Prepares the base path.
  *
  * @return string base path
  */
 protected function prepareBasePath()
 {
     $filename = basename($this->server->get('SCRIPT_FILENAME'));
     $baseUrl = $this->getBaseUrl();
     if (empty($baseUrl)) {
         return '';
     }
     if (basename($baseUrl) === $filename) {
         $basePath = dirname($baseUrl);
     } else {
         $basePath = $baseUrl;
     }
     if ('\\' === DIRECTORY_SEPARATOR) {
         $basePath = str_replace('\\', '/', $basePath);
     }
     return rtrim($basePath, '/');
 }
开发者ID:krisldz,项目名称:Gekosale2,代码行数:22,代码来源:Request.php

示例6: isFromTrustedProxy

 private function isFromTrustedProxy()
 {
     return self::$trustedProxies && IpUtils::checkIp($this->server->get('REMOTE_ADDR'), self::$trustedProxies);
 }
开发者ID:mesushan,项目名称:FirstRepo,代码行数:4,代码来源:Request.php

示例7: getRealMethod

 /**
  * Gets the "real" request method.
  *
  * @return string The request method
  *
  * @see getMethod
  */
 public function getRealMethod()
 {
     return strtoupper($this->server->get('REQUEST_METHOD', 'GET'));
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:11,代码来源:Request.php


注:本文中的Symfony\Component\HttpFoundation\ServerBag::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。