當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。