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


PHP Route::uri方法代码示例

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


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

示例1: uri

 /**
  * Get the uri.
  *
  * @return mixed
  */
 public function uri()
 {
     if (!is_null($this->route)) {
         return $this->route->uri();
     }
     return null;
 }
开发者ID:cskonline,项目名称:creation,代码行数:12,代码来源:CurrentRouteProvider.php

示例2: sort

 /**
  * Table sort order uri
  */
 public function sort(Jelly_Field $column, $foreign = null)
 {
     //Current page
     $page = $this->_target->request()->query($this->_config['current_page']['key']);
     //Request params
     $params = $this->_target->request()->query();
     //Set sort params
     $params[$this->_config['current_sort']['key']] = $column->name;
     if (!is_null($foreign) && $column instanceof Jelly_Field_Supports_With) {
         $model = Jelly::factory($column->foreign['model'])->meta();
         if ($model->field($foreign) !== NULL) {
             //Set sort params
             $params[$this->_config['current_sort']['key']] = ':' . $column->foreign['model'] . '.' . $foreign;
         }
     }
     //Set sort params
     $params[$this->_config['current_order']['key']] = $this->_direct;
     $class = '';
     $arrow = '<i class="fa fa-sort pull-right"></i>';
     if ($this->_sort_column == $column->name) {
         $arrow = $this->_direct == 'DESC' ? '<i class="fa fa-sort-desc pull-right"></i>' : '<i class="fa fa-sort-asc pull-right"></i>';
         $class = 'text-success';
     }
     return HTML::anchor($this->_route->uri($this->_target->route_params()) . URL::query($params), $column->label . $arrow, array('class' => $class));
 }
开发者ID:piotrtheis,项目名称:jelly,代码行数:28,代码来源:adapter.php

示例3: after

 /**
  * The after() method is called after controller action
  *
  * @uses  Route::uri
  */
 public function after()
 {
     if ($this->auto_render) {
         // Add styles
         $this->template->styles = array($this->_media->uri(array('file' => 'css/bootstrap.css')) => 'screen', $this->_media->uri(array('file' => 'css/install.css')) => 'screen');
         $this->template->logo = $this->_media->uri(array('file' => 'logo.png'));
         $this->template->link = $this->_media->uri(array('file' => 'favicon.ico'));
         // Do some CSS magic to page class
         $classes = array();
         $classes[] = I18n::$lang;
         $classes[] = $this->request->controller();
         $classes[] = $this->request->action();
         $page_class = implode(' ', array_unique(array_map('trim', $classes)));
         // Bind the generic page variables
         $this->template->set('lang', I18n::$lang)->set('page_class', $page_class);
     }
     parent::after();
 }
开发者ID:MenZil-Team,项目名称:cms,代码行数:23,代码来源:install.php

示例4: getURI

 private static function getURI()
 {
     $uri = $_SERVER['REQUEST_URI'];
     $uri = trim($uri, '/');
     $u = explode('/', $uri);
     if ($u[0] == 'index.php') {
         array_shift($u);
     }
     $uri = implode('/', $u);
     if ($uri == '') {
         $uri = '/';
     }
     self::$uri = $uri;
 }
开发者ID:phumaster,项目名称:fw,代码行数:14,代码来源:Route.php

示例5: url

 /**
  * Generates the full URL for a certain page.
  *
  * @param   integer int page number
  *
  * @uses Url::site
  * @return  string   page URL
  */
 public function url($page = 1)
 {
     // Clean the page number
     $page = max(1, (int) $page);
     // No page number in URLs to first page
     if ($page === 1 and !$this->_config->first_page_in_url) {
         $page = null;
     }
     switch ($this->_config->source) {
         case 'query':
             return URL::site($this->_route->uri($this->_route_params) . $this->query(array($this->_config->key => $page)));
         case 'route':
             return URL::site($this->_route->uri(array_merge($this->_route_params, array($this->_config->key => $page))) . $this->query());
     }
     return '#';
 }
开发者ID:nexeck,项目名称:kohana-pagination,代码行数:24,代码来源:pagination.php

示例6: url

 /**
  * Generates the full URL for a certain page
  *
  * @param   integer  $page  Page number [Optional
  *
  * @return  string
  *
  * @uses    URL::site
  */
 public function url($page = 1)
 {
     // Clean the page number
     $page = max(1, (int) $page);
     // gleez cms pagination
     $pager = '/p' . $page;
     // No page number in URLs to first page
     if ($page === 1 and !$this->config['first_page_in_url']) {
         $page = NULL;
         $pager = NULL;
     }
     switch ($this->config['current_page']['source']) {
         case 'query_string':
             return URL::site($this->_route->uri($this->_route_params) . $this->query(array($this->config['current_page']['key'] => $page)));
         case 'route':
             return URL::site($this->_route->uri(array_merge($this->_route_params, array($this->config['current_page']['key'] => $page))) . $this->query());
         case 'cms':
             return URL::site($this->_uri . $pager . $this->query());
     }
     return '#';
 }
开发者ID:ultimateprogramer,项目名称:cms,代码行数:30,代码来源:pagination.php

示例7: test_uri_fills_required_uri_segments_from_params

 /**
  * The logic for replacing required segments is separate (but similar) to that for
  * replacing optional segments.
  *
  * This test asserts that Route::uri will replace required segments with provided
  * params
  *
  * @dataProvider provider_uri_fills_required_uri_segments_from_params
  *
  * @test
  * @covers Route::uri
  */
 public function test_uri_fills_required_uri_segments_from_params($uri, $regex, $uri_string1, $uri_array1, $uri_string2, $uri_array2)
 {
     $route = new Route($uri, $regex);
     $this->assertSame($uri_string1, $route->uri($uri_array1));
     $this->assertSame($uri_string2, $route->uri($uri_array2));
 }
开发者ID:robert-kampas,项目名称:games-collection-manager,代码行数:18,代码来源:RouteTest.php

示例8: test_uri_fills_required_uri_segments_from_params

 /**
  * The logic for replacing required segments is separate (but similar) to that for
  * replacing optional segments.
  *
  * This test asserts that Route::uri will replace required segments with provided
  * params
  *
  * @test
  * @covers Route::uri
  */
 public function test_uri_fills_required_uri_segments_from_params()
 {
     $route = new Route('<controller>/<action>(/<id>)');
     $this->assertSame('users/edit', $route->uri(array('controller' => 'users', 'action' => 'edit')));
     $this->assertSame('users/edit/god', $route->uri(array('controller' => 'users', 'action' => 'edit', 'id' => 'god')));
 }
开发者ID:joelpittet,项目名称:core,代码行数:16,代码来源:RouteTest.php

示例9: Route

 /**
  * This tests the reverse routing returns the uri specified in the route
  * if it's a static route
  *
  * A static route is a route without any parameters
  *
  * @test
  * @covers Route::uri
  */
 function testReverseRoutingReturnsRoutesURIIfRouteIsStatic()
 {
     $route = new Route('info/about_us');
     $this->assertSame('info/about_us', $route->uri(array('some' => 'random', 'params' => 'to confuse')));
 }
开发者ID:pcraciunoiu,项目名称:unittest,代码行数:14,代码来源:RouteTest.php

示例10: compile

 /**
  * Execute a compiled route, and store the output to a file.
  *
  * @param Route         $route   The compiled route
  * @param mixed         $compile Bool, or an iteratable dataset to compile
  * @param array|Closure $vars    An array of vars, or a callback which
  *                               provides vars to be injected into the
  *                               route placeholders
  */
 public function compile($route, $data, $vars)
 {
     if ($data === true) {
         $data = [$data];
     }
     if (!(is_array($data) || $data instanceof Traversable)) {
         return;
     }
     // Loop through the provided data
     foreach ($data as $key => $value) {
         $params = $vars;
         if ($vars instanceof Closure) {
             // Run the compile callback to get the vars to include in the URI
             $params = $vars($value, $key);
         }
         // Pass the vars to the route, and spoof the returned URI
         $uri = $route->uri($params);
         $_SERVER['REQUEST_URI'] = $uri;
         $this->request->uri = $uri;
         // Execute the route, which now matches, and capture the results
         $result = $route->execute();
         $this->store($uri, $result);
     }
 }
开发者ID:pugphp,项目名称:framework,代码行数:33,代码来源:PageCompiler.php


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