CodeIgniter - >获取相对于基本网址的当前网址 [英] CodeIgniter -> Get current URL relative to base url

查看:88
本文介绍了CodeIgniter - >获取相对于基本网址的当前网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试过 URI :: uri_string() ,但不能让它与base_url一起工作。



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

返回: dropbox / derrek / shopredux / ahahaha / hihihi

http:// localhost / dropbox / derrek / shopredux / 只返回一个空字符串。



我想让第一个电话返回ahahaha / hihihi,第二个返回。是否有这样的功能?

解决方案

  //对于当前网址
回显BASE_URL(uri_string());


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

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

but http://localhost/dropbox/derrek/shopredux/ just returns an empty string.

I want the first call to return "ahahaha/hihihi" and the second to return "". Is there such a function?

解决方案

// For current url
echo base_url(uri_string());

这篇关于CodeIgniter - >获取相对于基本网址的当前网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆