简体   繁体   English

通过使用rest api的get方法获取在url中传递的数据

[英]get the data passed in url through get method using rest api

I have integrated rest controller with codeigniter. 我已将rest controller与codeigniter集成在一起。 following is the function for get method 以下是get方法的功能

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 我想从上面的函数http://localhost/login/index.php/admin/cource_topics中获取以下链接中的数据?key = value

Help me how to do this 帮帮我怎么做

You can normally get it using $this->input->get('key'); 您通常可以使用$ 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 您的函数编写中的控制器管理和函数cource_topics

$value = $this->input->get('key');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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