當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::setUri方法代碼示例

本文整理匯總了PHP中Zend\Http\PhpEnvironment\Request::setUri方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::setUri方法的具體用法?PHP Request::setUri怎麽用?PHP Request::setUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Http\PhpEnvironment\Request的用法示例。


在下文中一共展示了Request::setUri方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getRequest

 protected function getRequest()
 {
     $request = new Request();
     $request->setUri('http://localhost/base-path/asset-path');
     $request->setBasePath('/base-path');
     return $request;
 }
開發者ID:jguittard,項目名稱:AssetManager,代碼行數:7,代碼來源:AssetManagerTest.php

示例2: testDetect

 public function testDetect()
 {
     $request = new Request();
     $request->setUri('http://test.de');
     $event = new LocaleEvent();
     $event->setRequest($request);
     $event->setSupported(array('en_GB', 'de_DE'));
     $strategy = new HostStrategy();
     $strategy->setOptions(array('domain' => 'test.:locale', 'aliases' => array('de' => 'de_DE', 'co.uk' => 'en_GB')));
     $result = $strategy->detect($event);
     $this->assertSame('de_DE', $result);
 }
開發者ID:SoufianeAr,項目名稱:SlmLocale,代碼行數:12,代碼來源:HostStrategyTest.php

示例3: match

 /**
  * Match a URL against routes and parse to parameters
  *
  * Note: host is not checked for match
  *
  * @param string $url
  * @param string $route
  *
  * @throws \RuntimeException
  * @return RouteMatch|null
  */
 public function match($url, $route = '')
 {
     if (!$this->getRouter()) {
         throw new \RuntimeException('No RouteStackInterface instance provided');
     }
     $uri = new HttpUri($url);
     $request = new Request();
     $request->setUri($uri);
     $result = $this->getRouter()->match($request, $route);
     return $result;
 }
開發者ID:Andyyang1981,項目名稱:pi,代碼行數:22,代碼來源:Url.php

示例4: testFoundDoesNotRedirectWhenLocaleIsInPath

 public function testFoundDoesNotRedirectWhenLocaleIsInPath()
 {
     $request = new HttpRequest();
     $request->setUri('http://example.com/en/');
     $this->event->setLocale('en');
     $this->event->setRequest($request);
     $this->event->setResponse(new HttpResponse());
     $this->strategy->found($this->event);
     $statusCode = $this->event->getResponse()->getStatusCode();
     $header = $this->event->getResponse()->getHeaders()->has('Location');
     $this->assertNotEquals(302, $statusCode);
     $this->assertFalse($header);
 }
開發者ID:SoufianeAr,項目名稱:SlmLocale,代碼行數:13,代碼來源:UriPathStrategyTest.php


注:本文中的Zend\Http\PhpEnvironment\Request::setUri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。