我正在努力获得完整的网址。在我的ctp文件中,我试过:
$this->Url->build(null, true)
要么
$this->request->here;
并尝试在Controller文件:
use Cake\Routing\Router;
Router::url(null, true)
但是在审讯标记之后,没有一个返回所有参数。
基于documentation,您可以获取当前请求URL,包括查询字符串参数,如下所示:
$this->request->here(false)
use Cake\View\Helper\UrlHelper
$this->Url->build($this->request->here(), true);
要么
use Cake\Routing\Router
Router::url($this->request->here(), true);
两者在CTP文件上的工作方式相同