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


PHP Request::getRealMethod方法代码示例

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


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

示例1: getRequestParameters

 public function getRequestParameters()
 {
     if ($this->request->getRealMethod() === 'POST') {
         return $this->request->request->all();
     } else {
         return $this->request->query->all();
     }
 }
开发者ID:simgroep,项目名称:oauth1-service,代码行数:8,代码来源:SymfonyRequest.php

示例2: logRequest

 /**
  * Log an incoming request from the middleware.
  *
  * @param Request $request
  *                         The incoming request.
  * @param int     $type
  *                         The type of request (master or sub request).
  */
 protected function logRequest(Request $request, $type = HttpKernelInterface::MASTER_REQUEST)
 {
     if ($type == HttpKernelInterface::MASTER_REQUEST) {
         // Starts timers and logs.
         Database::startLog('console_logger');
         if ($request->getRealMethod() == 'POST') {
             $parameters = $request->request->all();
             $parameters = $this->sanitizeParameters($parameters);
             if (!empty($parameters)) {
                 $this->logger->log($this->logLevel, 'Request parameters', $parameters);
             }
         }
     }
 }
开发者ID:caxy,项目名称:drupal-console-logging-middleware,代码行数:22,代码来源:ProfilerLoggingMiddleware.php

示例3: handleRequestToken

 /**
  * Handles the request token.
  *
  * @throws AjaxRedirectResponseException|InvalidRequestTokenException If the token is invalid
  */
 private function handleRequestToken()
 {
     // Deprecated since Contao 4.0, to be removed in Contao 5.0
     if (!defined('REQUEST_TOKEN')) {
         define('REQUEST_TOKEN', $this->tokenManager->getToken($this->csrfTokenName)->getValue());
     }
     if (null === $this->request || 'POST' !== $this->request->getRealMethod()) {
         return;
     }
     $token = new CsrfToken($this->csrfTokenName, $this->request->request->get('REQUEST_TOKEN'));
     if ($this->tokenManager->isTokenValid($token)) {
         return;
     }
     if ($this->request->isXmlHttpRequest()) {
         throw new AjaxRedirectResponseException($this->router->generate('contao_backend'));
     }
     throw new InvalidRequestTokenException('Invalid request token. Please reload the page and try again.');
 }
开发者ID:jamesdevine,项目名称:core-bundle,代码行数:23,代码来源:ContaoFramework.php

示例4: logRequest

 /**
  * Request のログを出力する.
  *
  * @param Request $request
  * @return string Request のログ
  */
 protected function logRequest(Request $request)
 {
     $log = '';
     $log .= $this->logKeyValuePair('REMOTE_ADDR', $request->getClientIp());
     $log .= $this->logKeyValuePair('SCRIPT_NAME', $request->getScriptName());
     $log .= $this->logKeyValuePair('PATH_INFO', $request->getPathInfo());
     $log .= $this->logKeyValuePair('BASE_PATH', $request->getBasePath());
     $log .= $this->logKeyValuePair('BASE_URL', $request->getBaseUrl());
     $log .= $this->logKeyValuePair('SCHEME', $request->getScheme());
     $log .= $this->logKeyValuePair('REMOTE_USER', $request->getUser());
     $log .= $this->logKeyValuePair('HTTP_HOST', $request->getSchemeAndHttpHost());
     $log .= $this->logKeyValuePair('REQUEST_URI', $request->getRequestUri());
     $log .= $this->logKeyValuePair('METHOD', $request->getRealMethod());
     $log .= $this->logKeyValuePair('LOCALE', $request->getLocale());
     // $log .= $this->logArray($request->server->all(), '[server]'); // 大量にログ出力される...
     $log .= $this->logArray($request->headers->all(), '[header]');
     $log .= $this->logArray($request->query->all(), '[get]');
     $log .= $this->logArray($request->request->all(), '[post]');
     $log .= $this->logArray($request->attributes->all(), '[attributes]');
     $log .= $this->logArray($request->cookies->all(), '[cookie]');
     $log .= $this->logArray($request->files->all(), '[files]');
     return $log;
 }
开发者ID:ec-cube,项目名称:ec-cube,代码行数:29,代码来源:RequestDumpListener.php

示例5: indexAction

 /**
  * @param Request $request
  * @return JsonResponse
  *
  * @Route("/{entity}/{id}", name="basic_auth", defaults={"id" = 1})
  */
 public function indexAction(Request $request)
 {
     /** @var User $user */
     $user = $this->getUser();
     return new JsonResponse(['method' => $request->getRealMethod(), 'path' => $request->getPathInfo(), 'query_params' => $request->query->all(), 'headers' => $request->headers->all(), 'content' => $this->getContent($request), 'files' => $_FILES, 'user' => ['username' => $user->getUsername(), 'password' => $user->getPassword()]]);
 }
开发者ID:epfremmer,项目名称:retrofit-php,代码行数:12,代码来源:BasicController.php

示例6: canSkipTokenCheck

 /**
  * Checks if the token check can be skipped.
  *
  * @return bool True if the token check can be skipped
  */
 private function canSkipTokenCheck()
 {
     return null === $this->request || 'POST' !== $this->request->getRealMethod() || !$this->request->attributes->has('_token_check') || false === $this->request->attributes->get('_token_check');
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:9,代码来源:ContaoFramework.php

示例7: __construct

 /**
  * Creates a Visitor object.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request The request of the visitor
  */
 public function __construct(Request $request)
 {
     $this->ip = $request->getClientIp();
     $this->headers = $request->headers;
     $this->method = $request->getRealMethod();
     $this->uri = $request->getRequestUri();
     $this->data = $request->request;
     $this->scheme = $request->getScheme();
     $this->protocol = $request->server->get('SERVER_PROTOCOL');
     $userAgent = $request->headers->get('user-agent');
     $this->userAgent = new UserAgent($userAgent);
     $knownBrowsers = ['msie', 'firefox', 'chrome', 'safari', 'opera', 'konqueror', 'edge', 'lynx'];
     $this->isBrowser = in_array($this->userAgent->getBrowserName(), $knownBrowsers);
 }
开发者ID:flamecore,项目名称:gatekeeper,代码行数:19,代码来源:Visitor.php

示例8: format

 /**
  * @param Request $request
  * @param Response $response
  * @return string
  */
 public function format(Request $request, Response $response)
 {
     return sprintf("%s %s      %s      %s <<<< %s %s      %s      %s", $request->getRealMethod(), $request->getRequestUri(), $this->formatHeaders($request->headers), $this->getContent($request), $response->getStatusCode(), Response::$statusTexts[$response->getStatusCode()], $this->formatHeaders($response->headers), $response->getContent());
 }
开发者ID:vesax,项目名称:http-kernel-logger-bundle,代码行数:9,代码来源:Formatter.php


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