我正在创建一个页面访问者模块。目标是了解访问最多的用户,以及访问最多的模块。
我想获取当前页面的页面路由。
下面是我想做的事情:
1.我有一个模块叫库存模块。
1.此模块有一个路由'merchandiser/report/inventory'
。(在routes.php
中,它是$route['merchandiser/report/inventory'])
。
这是我想要的路线。
我试过:
<?php echo current_url(); ?>
但它返回的结果是这样的。
192.168.3.3/portal/merchandiser/report/inventory
192.168.3.3/portal/
是我的基本网址'
现在我的问题是:
如何删除192.168.3.3/portal/
而只得到merchandiser/report/inventory
希望你能指引我或者带我去哪里找它。
谢谢您的支持。
7条答案
按热度按时间dfty9e191#
希望这对您有所帮助:
使用
url
助手的如果您URL是:
该函数将返回:
有关详细信息,请访问:https://www.codeigniter.com/user_guide/helpers/url_helper.html#uri_string
或者您可以使用uri,类似于:
https://www.codeigniter.com/user_guide/libraries/uri.html
lokaqttq2#
你可以在codeigniter中使用这个。
它将返回当前URL的段。
ht4b089n3#
这个作品很有魅力:
您可以打印出这些值或在身份验证后使用redirect(“$controller/$method”)进行重定向;
vd8tlhqk4#
在codeigniter 4中,您可以设置路由名称并使用来获取路由名称
并得到控制器和方法
ix0qys7i5#
我认为代码点火器urlhelper应该做的工作与:
oxf4rvwz6#
使用此
dly7yett7#
我用它来获取当前页面: