简体   繁体   中英

CakePHP 1.3 - Extract URL GET parameters

I have CakePHP 1.3.2 application working with similar URLs:

/controller/action/name1:value1/name2:value2.html

I'm trying to extract the values after the : sign specified by the names before that. I can see the whole URL with no problem using $this->params['url'] , however, I can't get the value itself using neither $this->params['name1'] , nor $this->params['url']['name1'] . Any tips?

From the Cakephp 1.3 book :

URL: /contents/view/chapter:models/section:associations Mapping:

ContentsController->view(); $this->passedArgs['chapter'] = 'models';

$this->passedArgs['section'] = 'associations';

$this->params['named']['chapter'] = 'models';

$this->params['named']['section'] = 'associations';

So you should use:

$this->params['named']['name1']
$this->params['named']['name2']

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM