通过使用rest api的get方法获取在url中传递的数据
问题描述:
I have integrated rest controller with codeigniter. following is the function for get method
public function cource_topics_get($res=1) {
$this->response(array('status' => 1, 'succ_message' => $res));
}
I want to get the data from following link in the above function http://localhost/login/index.php/admin/cource_topics?key=value
Help me how to do this
我已将rest controller与codeigniter集成在一起。 以下是get方法的函数 p>
public function cource_topics_get($ res = 1){
$ this-> response(array('status'=> 1, 'succ_message'=> $ res));
}
code> pre>
我想从上面函数中的以下链接获取数据
http://localhost/login/index.php/admin/cource_topics?key = value p>
帮我解决这个问题 p>
div>
答
You can normally get it using $this->input->get('key');
http://localhost/login/index.php/admin/cource_topics?key=value
You controller admin and function cource_topics in your function write
$value = $this->input->get('key');