如何在Codeigniter中接收发布/获取请求 [英] How to receive post/get request in codeigniter
问题描述
我正在使用
$this->input->post('name') ;
可以将请求发布到我的网址.我也需要访问get来代替发布.
$this->input->post('name') ;
to get a request posted to my url.Instead of post I need to access get as well.
像普通的php一样,使用$ _REQUEST.但是在代码点火器标准中,怎么可能呢?
Like in normal php its ,$_REQUEST is used.But what about in codeigniter standards,how is it possible?
推荐答案
此处的文档中对此进行了概述: http://ellislab.com/codeigniter/user-guide/libraries/input.html
It's outlined in the docs here: http://ellislab.com/codeigniter/user-guide/libraries/input.html
要从get
获取数据,您可以使用
To grab data from the get
you can use
$this->input->get('some_data', TRUE);
它将在查询字符串中查找some_data
,并将通过XSS过滤运行以清除可能的黑客企图
That looks for some_data
in the query string, and will run is through XSS filtering to clean it from possible hack attempts
还有一种方便的方法可以同时检查两者:
There's also a handy method to check both at the same time:
$this->input->get_post('some_data', TRUE);
此功能将在帖子中搜索并获取数据流,先在帖子中查找,然后在get中查找"
"This function will search through both the post and get streams for data, looking first in post, and then in get"
这篇关于如何在Codeigniter中接收发布/获取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!