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


PHP Request::getCharsets方法代码示例

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


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

示例1: createContexts

 public function createContexts(Request $request)
 {
     $map = array('request_method' => $request->getMethod(), 'request_uri' => $request->getRequestUri(), 'request_route' => $request->attributes->get('_route'), 'request_host' => $request->getHost(), 'request_port' => $request->getPort(), 'request_scheme' => $request->getScheme(), 'request_client_ip' => $request->getClientIp(), 'request_content_type' => $request->getContentType(), 'request_acceptable_content_types' => $request->getAcceptableContentTypes(), 'request_etags' => $request->getETags(), 'request_charsets' => $request->getCharsets(), 'request_languages' => $request->getLanguages(), 'request_locale' => $request->getLocale(), 'request_auth_user' => $request->getUser(), 'request_auth_has_password' => !is_null($request->getPassword()));
     // Attributes from newer versions.
     if (method_exists($request, 'getEncodings')) {
         $map['request_encodings'] = $request->getEncodings();
     }
     if (method_exists($request, 'getClientIps')) {
         $map['request_client_ips'] = $request->getClientIps();
     }
     return $map;
 }
开发者ID:Hexanet,项目名称:MonologExtraBundle,代码行数:12,代码来源:RequestLogger.php

示例2: logRequest

 protected function logRequest(Request $request)
 {
     $msg = 'Request "{request_method} {request_uri}"';
     $map = array('request_method' => $request->getMethod(), 'request_uri' => $request->getRequestUri(), 'request_host' => $request->getHost(), 'request_port' => $request->getPort(), 'request_scheme' => $request->getScheme(), 'request_client_ip' => $request->getClientIp(), 'request_content_type' => $request->getContentType(), 'request_acceptable_content_types' => $request->getAcceptableContentTypes(), 'request_etags' => $request->getETags(), 'request_charsets' => $request->getCharsets(), 'request_languages' => $request->getLanguages(), 'request_locale' => $request->getLocale(), 'request_auth_user' => $request->getUser(), 'request_auth_has_password' => !is_null($request->getPassword()));
     // Attributes from newer versions.
     if (method_exists($request, 'getEncodings')) {
         $map['request_encodings'] = $request->getEncodings();
     }
     if (method_exists($request, 'getClientIps')) {
         $map['request_client_ips'] = $request->getClientIps();
     }
     $this->logger->log($this->logLevel, $msg, $map);
 }
开发者ID:caxy,项目名称:drupal-console-logging-middleware,代码行数:13,代码来源:RequestLoggingMiddleware.php

示例3: testGetCharsets

 public function testGetCharsets()
 {
     $request = new Request();
     $this->assertEquals(array(), $request->getCharsets());
     $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
     $this->assertEquals(array(), $request->getCharsets());
     // testing caching
     $request = new Request();
     $request->headers->set('Accept-Charset', 'ISO-8859-1, US-ASCII, UTF-8; q=0.8, ISO-10646-UCS-2; q=0.6');
     $this->assertEquals(array('ISO-8859-1', 'US-ASCII', 'UTF-8', 'ISO-10646-UCS-2'), $request->getCharsets());
     $request = new Request();
     $request->headers->set('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7');
     $this->assertEquals(array('ISO-8859-1', 'utf-8', '*'), $request->getCharsets());
 }
开发者ID:anderson-abc,项目名称:sf2_kowee,代码行数:14,代码来源:RequestTest.php

示例4: mapRequest

 private function mapRequest(Request $request, $full = false)
 {
     $mapRequest = array();
     if ($full) {
         $mapRequest['ip'] = $request->getClientIp();
         $mapRequest['method'] = $request->getMethod();
         $mapRequest['host'] = $request->getHttpHost();
         $mapRequest['port'] = $request->getPort();
         $mapRequest['scheme'] = $request->getScheme();
         $mapRequest['uri'] = $request->getUri();
         $mapRequest['requestUri'] = $request->getRequestUri();
         $mapRequest['queryString'] = $request->getQueryString();
         $mapRequest['isSecure'] = $request->isSecure();
         $mapRequest['content'] = $request->getContent();
         $mapRequest['preferredLanguage'] = $request->getPreferredLanguage();
         $mapRequest['languages'] = $request->getLanguages();
         $mapRequest['charsets'] = $request->getCharsets();
         $mapRequest['acceptableContentTypes'] = $request->getAcceptableContentTypes();
         $mapRequest['isXmlHttpRequest'] = $request->isXmlHttpRequest();
         $mapRequest['to_string'] = $request->__toString();
         $mapRequest['server'] = $request->server;
         $mapRequest['headers'] = $request->headers;
         $mapRequest['cookies'] = $request->cookies;
         $mapRequest['oriLocale'] = $request->getLocale();
         $mapRequest['guessedLocale'] = $this->getLocaleManager()->getGuessedLocale();
     }
     $mapRequest['locale'] = $request->getLocale();
     $mapRequest['_route'] = $request->get('_route');
     $mapRequest['_controller'] = $request->get('_controller');
     $mapRequest['_route_params'] = $request->get('_route_params');
     return $mapRequest;
 }
开发者ID:techgardeners,项目名称:sf-baseprj-bundle,代码行数:32,代码来源:MainKernel.php


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