本文整理汇总了PHP中Cake\Routing\Router::parseNamedParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Router::parseNamedParams方法的具体用法?PHP Router::parseNamedParams怎么用?PHP Router::parseNamedParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Routing\Router
的用法示例。
在下文中一共展示了Router::parseNamedParams方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeFilter
/**
* Pass this call through to CrudView plugin
*/
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
Router::parseNamedParams($this->request);
// $this->Auth->allow(['index', 'view', 'display', 'edit']);
}
示例2: testParseNamedParameters
/**
* Test that the compatibility method for incoming urls works.
*
* @return void
*/
public function testParseNamedParameters()
{
$request = new Request();
$request->addParams(array('controller' => 'posts', 'action' => 'index'));
$result = Router::parseNamedParams($request);
$this->assertSame([], $result->params['named']);
$request = new Request();
$request->addParams(array('controller' => 'posts', 'action' => 'index', 'pass' => array('home', 'one:two', 'three:four', 'five[nested][0]:six', 'five[nested][1]:seven')));
Router::parseNamedParams($request);
$expected = array('plugin' => null, 'controller' => 'posts', 'action' => 'index', '_ext' => null, 'pass' => array('home'), 'named' => array('one' => 'two', 'three' => 'four', 'five' => array('nested' => array('six', 'seven'))));
$this->assertEquals($expected, $request->params);
}
示例3: checkRoute
public function checkRoute($route = null)
{
list($controller, $action) = explode('#', $route);
$params = Router::parseNamedParams($this->request);
return $params['controller'] == $controller && $params['action'] == $action;
}