简体   繁体   English

Phalcon 4 如何获取当前页面的 URL?

[英]Phalcon 4 How to get URL of current page?

In phalcon 3.4 we had the below function to get the current URL,在 phalcon 3.4 中,我们有以下函数来获取当前 URL,

$current_url = $this->router->getRewriteUri();

However, it seems to be that, it was dropped in version 4.0 however there is no direct corresponding function for this i could find.但是,它似乎是在 4.0 版中删除的,但是我找不到直接对应的功能。 Can you please let me know how to change this function to adapt to version 4.0+ Or should i just use the direct way (I usually hate to mix things up) but looks like no other choice您能否让我知道如何更改此功能以适应 4.0+ 版本,或者我应该使用直接方式(我通常讨厌混淆)但看起来没有其他选择

$_SERVER['REQUEST_URI']

您可以使用Phalcon\\Http\\Request::getURI()但它使用$_SERVER['REQUEST_URI']如果您的项目不在根路径上,您可能想要使用$_GET['_url']

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

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