本文整理匯總了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);
}
示例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']);
}
示例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);
}