[英]How to get data from url in codeigniter
I want to get /1 from this url but i can't. 我想从这个网址获得/ 1,但我不能。
http://localhost/medical/common/nurse/search?nrs_name=&nrs_phone=&nrs_id=&nrs_gender=2&nrs_address=/1 HTTP://本地主机/医疗/普通/护士/搜索nrs_name =&nrs_phone =&nrs_id =&nrs_gender = 2&nrs_address = / 1
Here /1 is the page no 这里/ 1是页面号
Try like this 试试这样吧
$parameter = $this->input->get('nrs_address');
OR 要么
$parameter = $_GET['nrs_address'];
you can try this one 你可以尝试这个
$urldata = $this->input->get();
you will get all url data on $urldata variable in associative array (key-value pair) form. 您将获得关联数组(键值对)表单中$ urldata变量的所有url数据。 and you can use it like this one.
你可以像这样使用它。
$urldata['nrs_name'] $ urldata [ 'nrs_name']
if you have to pass the value you should enter url like this 如果你必须传递值,你应该像这样输入url
localhost/yoururl/index.php/abc_controller/70
and in controller function you can get like this: 在控制器功能中,您可以这样:
public function index( $id = NULL ) {
echo $id;
}
Reference: 参考:
https://www.codeigniter.com/userguide3/libraries/input.html?highlight=get%20url#using-post-get-cookie-or-server-data https://www.codeigniter.com/userguide3/libraries/input.html?highlight=get%20url#using-post-get-cookie-or-server-data
Apply this code. 应用此代码。
$nrs_address= $_GET['nrs_address'];
echo $nrs_address;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.