本文整理汇总了PHP中Zend\Mvc\Router\Http\TreeRouteStack::setRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP TreeRouteStack::setRequestUri方法的具体用法?PHP TreeRouteStack::setRequestUri怎么用?PHP TreeRouteStack::setRequestUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Mvc\Router\Http\TreeRouteStack
的用法示例。
在下文中一共展示了TreeRouteStack::setRequestUri方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAssembleCanonicalUriWithHostnameRouteAndRequestUriWithoutScheme
public function testAssembleCanonicalUriWithHostnameRouteAndRequestUriWithoutScheme()
{
$uri = new HttpUri();
$uri->setScheme('http');
$stack = new TreeRouteStack();
$stack->setRequestUri($uri);
$stack->addRoute('foo', new Hostname('example.com'));
$this->assertEquals('http://example.com', $stack->assemble(array(), array('name' => 'foo')));
}
示例2: testAssembleWithScheme
public function testAssembleWithScheme()
{
$uri = new HttpUri();
$uri->setScheme('http');
$uri->setHost('example.com');
$stack = new TreeRouteStack();
$stack->setRequestUri($uri);
$stack->addRoute(
'secure',
array(
'type' => 'Scheme',
'options' => array(
'scheme' => 'https'
),
'child_routes' => array(
'index' => array(
'type' => 'Literal',
'options' => array(
'route' => '/',
),
),
),
)
);
$this->assertEquals('https://example.com/', $stack->assemble(array(), array('name' => 'secure/index')));
}
示例3: testAssembleWithQueryRoute
public function testAssembleWithQueryRoute()
{
$uri = new HttpUri();
$uri->setScheme('http');
$stack = new TreeRouteStack();
$stack->setRequestUri($uri);
$stack->addRoute('index', array('type' => 'Literal', 'options' => array('route' => '/'), 'child_routes' => array('query' => array('type' => 'Query'))));
$this->assertEquals('/?bar=baz', $stack->assemble(array('bar' => 'baz'), array('name' => 'index/query')));
}
示例4: testChainRouteAssemblingWithChildrenAndSecureScheme
public function testChainRouteAssemblingWithChildrenAndSecureScheme()
{
$stack = new TreeRouteStack();
$uri = new \Zend\Uri\Http();
$uri->setHost('localhost');
$stack->setRequestUri($uri);
$stack->addRoute('foo', array('type' => 'literal', 'options' => array('route' => '/foo'), 'chain_routes' => array(array('type' => 'scheme', 'options' => array('scheme' => 'https'))), 'child_routes' => array('baz' => array('type' => 'literal', 'options' => array('route' => '/baz')))));
$this->assertEquals('https://localhost/foo/baz', $stack->assemble(array(), array('name' => 'foo/baz')));
}