使用CakePHP提取URL值(参数) [英] Extract URL value with CakePHP (params)
问题描述
我知道CakePHP参数很容易从这样的URL中提取值:
I know that CakePHP params easily extracts values from an URL like this one:
http://www.example.com/tester/retrieve_test/good/1/accepted/active
我需要像这样从URL中提取值:
I need to extract values from an URL like this:
http://www.example.com/tester/retrieve_test?status=200&id=1yOhjvRQBgY
我只需要此ID中的值:
I only need the value from this id:
id = 1yOhjvRQBgY
id=1yOhjvRQBgY
我知道在正常的PHP中,$ _ GET会很容易地检索到它,但是我无法将其插入到数据库中,我使用了以下代码:
I know that in normal PHP $_GET will retrieve this easally, bhut I cant get it to insert the value into my DB, i used this code:
$html->input('Listing/vt_tour', array('value'=>$_GET["id"], 'type'=>'hidden'))
有什么想法的人吗?
推荐答案
使用这种方式
echo $this->params['url']['id'];
它在cakephp手册上 http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Controllers.html#the-parameters-attribute-params
it's here on cakephp manual http://book.cakephp.org/1.3/en/The-Manual/Developing-with-CakePHP/Controllers.html#the-parameters-attribute-params
这篇关于使用CakePHP提取URL值(参数)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!