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


PHP Url::get方法代码示例

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


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

示例1: testGet

 public function testGet()
 {
     $url = new Url();
     $url->setBaseUri('http://www.test.com');
     $this->assertEquals('http://www.test.com', $url->get(''));
     $this->assertEquals('http://www.test.com/', $url->get('/'));
     $this->assertEquals('http://www.test.com/path', $url->get('/path'));
     $url->setBaseUri('http://www.test.com/?_url=/');
     $this->assertEquals('http://www.test.com/?_url=/path&params=one', $url->get('path', array('params' => 'one')));
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:10,代码来源:UrlTest.php

示例2: get

 public function get($url = null, $args = null, $local = null)
 {
     //		if ( $args == null ) {
     //			$args = [ ];
     //		}
     //		$a = parent::get( $url, array_merge( [ SITE_ID => "" ], $args ), $local );
     $a = parent::get($url);
     return $a;
 }
开发者ID:csthink,项目名称:csthink,代码行数:9,代码来源:services.php

示例3: get

 /**
  * @param null $uri
  * @param null $args
  * @return string
  */
 public function get($uri = null, $args = null, $local = null)
 {
     if (isset($uri['for'])) {
         $lang = null;
         if (isset($uri[LangRouter::LANG_PARAM])) {
             $lang = $uri[LangRouter::LANG_PARAM];
         }
         $route = $this->getDI()->getRouter()->getRouteByName($uri['for'], $lang);
         if ($route === null) {
             return "notfound";
         } else {
             $paths = $route->getPaths();
             $request = $this->getDI()->getRequest();
             $dispatcher = $this->getDI()->getDispatcher();
             foreach ($paths as $pathKey => $value) {
                 if (!array_key_exists($pathKey, $uri) && $pathKey !== 'for' && $pathKey) {
                     $uri[$pathKey] = $dispatcher->getParam($pathKey) ?: $value;
                 }
             }
             // if query args should be included
             if (!isset($uri['type']) || $uri['type'] !== 'no_query') {
                 if ($args === null) {
                     $args = [];
                 }
                 if ($uri['for'] === 'this') {
                     foreach ($request->get() as $param => $value) {
                         if (!array_key_exists($param, $args) && $param !== '_url' && $param !== 'setLang') {
                             $args[$param] = $value;
                         }
                     }
                 }
             }
             if ($lang !== null) {
                 $uri["for"] = $route->getName();
             }
         }
     }
     return parent::get($uri, $args);
 }
开发者ID:kathynka,项目名称:Foundation,代码行数:44,代码来源:Url.php

示例4: get

 public function get($uri = null, $args = null, $local = null)
 {
     return parent::get($uri, $args, $local);
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:4,代码来源:Url.php

示例5: testIssue1960

 /**
  * @ticket 1960
  * @author Vladimir Kolesnikov <vladimir@extrememember.com>
  * @since 2014-02-02
  */
 public function testIssue1960()
 {
     $url = new \Phalcon\Mvc\Url();
     $url->setDI($this->di);
     $params = 'http://www.google.com/';
     $expected = 'http://www.google.com/';
     $actual = $url->get($params);
     $this->assertEquals($expected, $actual, 'External Site Url not correct');
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:14,代码来源:UnitTest.php

示例6: testUrlForExternalSite

 /**
  * Tests the url with external website
  *
  * @author Nikos Dimopoulos <nikos@phalconphp.com>
  * @since  2012-11-29
  */
 public function testUrlForExternalSite()
 {
     $url = new PhUrl();
     $url->setDI($this->di);
     $params = array('for' => 'wikipedia', 'article' => 'Television_news');
     $expected = '/wiki/Television_news';
     $actual = $url->get($params);
     $this->assertEquals($expected, $actual, 'External Site Url not correct');
 }
开发者ID:lisong,项目名称:cphalcon,代码行数:15,代码来源:UnitTest.php

示例7: generateUrl

 /**
  * Gets the url
  *
  * @param string[] $queryParams
  *
  * @return string
  */
 private function generateUrl($queryParams)
 {
     $params = $this->getRequest()->getQuery();
     //Remove htaccess mod rewrite query
     if (array_key_exists('_url', $params)) {
         unset($params['_url']);
     }
     //Override with the new parameters
     foreach ($queryParams as $name => $value) {
         $params[$name] = $value;
     }
     $url = new Url();
     return 'https://' . $this->getRequest()->getHttpHost() . substr($url->get($this->getRequest()->getQuery('_url'), $params), 1);
 }
开发者ID:bullhorn,项目名称:fast-rest,代码行数:21,代码来源:Index.php

示例8: generateUri

 /**
  * {@inheritdoc}
  */
 public function generateUri($name, array $substitutions = [])
 {
     return $this->url->get(array_merge(['for' => $name], $substitutions));
 }
开发者ID:theDisco,项目名称:phalcon-expressive,代码行数:7,代码来源:PhalconRouter.php


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