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


PHP RequestContext::getQueryString方法代码示例

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


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

示例1: testFromRequest

 public function testFromRequest()
 {
     $request = Request::create('https://test.com:444/foo?bar=baz');
     $requestContext = new RequestContext();
     $requestContext->setHttpPort(123);
     $requestContext->fromRequest($request);
     $this->assertEquals('', $requestContext->getBaseUrl());
     $this->assertEquals('GET', $requestContext->getMethod());
     $this->assertEquals('test.com', $requestContext->getHost());
     $this->assertEquals('https', $requestContext->getScheme());
     $this->assertEquals('/foo', $requestContext->getPathInfo());
     $this->assertEquals('bar=baz', $requestContext->getQueryString());
     $this->assertSame(123, $requestContext->getHttpPort());
     $this->assertSame(444, $requestContext->getHttpsPort());
     $request = Request::create('http://test.com:8080/foo?bar=baz');
     $requestContext = new RequestContext();
     $requestContext->setHttpsPort(567);
     $requestContext->fromRequest($request);
     $this->assertSame(8080, $requestContext->getHttpPort());
     $this->assertSame(567, $requestContext->getHttpsPort());
 }
开发者ID:TuxCoffeeCorner,项目名称:tcc,代码行数:21,代码来源:RequestContextTest.php

示例2: rebuildRequest

 /**
  * Rebuild the request object from a URL with the help of the RequestContext.
  *
  * If the request context is not set, this simply returns the request object built from $uri.
  *
  * @param string $pathinfo
  *
  * @return Request
  */
 private function rebuildRequest($pathinfo)
 {
     if (!$this->context) {
         return Request::create('http://localhost' . $pathinfo);
     }
     $uri = $pathinfo;
     $server = array();
     if ($this->context->getBaseUrl()) {
         $uri = $this->context->getBaseUrl() . $pathinfo;
         $server['SCRIPT_FILENAME'] = $this->context->getBaseUrl();
         $server['PHP_SELF'] = $this->context->getBaseUrl();
     }
     $host = $this->context->getHost() ?: 'localhost';
     if ('https' === $this->context->getScheme() && 443 !== $this->context->getHttpsPort()) {
         $host .= ':' . $this->context->getHttpsPort();
     }
     if ('http' === $this->context->getScheme() && 80 !== $this->context->getHttpPort()) {
         $host .= ':' . $this->context->getHttpPort();
     }
     $uri = $this->context->getScheme() . '://' . $host . $uri . '?' . $this->context->getQueryString();
     return Request::create($uri, $this->context->getMethod(), $this->context->getParameters(), array(), array(), $server);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:31,代码来源:ChainRouter.php

示例3: testQueryString

 public function testQueryString()
 {
     $requestContext = new RequestContext();
     $requestContext->setQueryString(null);
     $this->assertSame('', $requestContext->getQueryString());
 }
开发者ID:peintune,项目名称:Ternado,代码行数:6,代码来源:RequestContextTest.php


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