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


PHP TreeRouteStack::setRequestUri方法代码示例

本文整理汇总了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')));
 }
开发者ID:bradley-holt,项目名称:zf2,代码行数:9,代码来源:TreeRouteStackTest.php

示例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')));
 }
开发者ID:benivaldo,项目名称:zf2-na-pratica,代码行数:26,代码来源:TreeRouteStackTest.php

示例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')));
 }
开发者ID:robertodormepoco,项目名称:zf2,代码行数:9,代码来源:TreeRouteStackTest.php

示例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')));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:9,代码来源:TreeRouteStackTest.php


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