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


PHP CakeRoute::persistParams方法代码示例

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


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

示例1: persistParams

 /**
  * Saves any skipPatterns flag
  *
  * @param array $url
  * @param array $params
  * @return array|void
  */
 public function persistParams($url, $params)
 {
     if (isset($url['skipPatterns']) && $url['skipPatterns']) {
         $this->skipPatterns = true;
         unset($url['skipPatterns']);
     }
     return parent::persistParams($url, $params);
 }
开发者ID:slachiewicz,项目名称:_mojePanstwo-API-Server,代码行数:15,代码来源:ApiRoute.php

示例2: testPersistParams

 /**
  * test persistParams ability to persist parameters from $params and remove params.
  *
  * @return void
  */
 public function testPersistParams()
 {
     $route = new CakeRoute('/:lang/:color/blog/:action', array('controller' => 'posts'), array('persist' => array('lang', 'color')));
     $url = array('controller' => 'posts', 'action' => 'index');
     $params = array('lang' => 'en', 'color' => 'blue');
     $result = $route->persistParams($url, $params);
     $this->assertEquals('en', $result['lang']);
     $this->assertEquals('blue', $result['color']);
     $url = array('controller' => 'posts', 'action' => 'index', 'color' => 'red');
     $params = array('lang' => 'en', 'color' => 'blue');
     $result = $route->persistParams($url, $params);
     $this->assertEquals('en', $result['lang']);
     $this->assertEquals('red', $result['color']);
 }
开发者ID:pritten,项目名称:SmartCitizen.me,代码行数:19,代码来源:CakeRouteTest.php

示例3: testPersistParamsNonArray

 /**
  * test persist with a non array value
  *
  * @return void
  */
 public function testPersistParamsNonArray()
 {
     $url = array('controller' => 'posts', 'action' => 'index');
     $params = array('lang' => 'en', 'color' => 'blue');
     $route = new CakeRoute('/:lang/:color/blog/:action', array('controller' => 'posts'));
     $result = $route->persistParams($url, $params);
     $this->assertEquals($url, $result);
     $route = new CakeRoute('/:lang/:color/blog/:action', array('controller' => 'posts'), array('persist' => false));
     $result = $route->persistParams($url, $params);
     $this->assertEquals($url, $result);
     $route = new CakeRoute('/:lang/:color/blog/:action', array('controller' => 'posts'), array('persist' => 'derp'));
     $result = $route->persistParams($url, $params);
     $this->assertEquals($url, $result);
 }
开发者ID:jgera,项目名称:orangescrum,代码行数:19,代码来源:CakeRouteTest.php


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