本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}