CodeIgniter -> Get current URL relative to base url

后端 未结 10 1131
情话喂你
情话喂你 2020-12-29 05:08

Tried URI::uri_string() but can\'t get it to work with the base_url.

URL: http://localhost/dropbox/derrek/shopredux/ahahaha/hihihi
Returns: dr

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 05:24

    you can use the some Codeigniter functions and some core functions and make combination to achieve your URL with query string. I found solution of this problem.

    base_url($this->uri->uri_string()).strrchr($_SERVER['REQUEST_URI'], "?");
    

    and if you loaded URL helper so you can also do this current_url().strrchr($_SERVER['REQUEST_URI'], "?");

提交回复
热议问题