本文整理汇总了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);
}