How to get complete current url for Cakephp

前端 未结 24 1297
长情又很酷
长情又很酷 2020-12-08 00:10

How do you echo out current URL in Cake\'s view?

24条回答
  •  余生分开走
    2020-12-08 00:53

    The simplest way I found is it that includes host/path/query and
    works in Controllers (Cakephp 3.4):

    Cake\View\Helper\UrlHelper::build($this->request->getRequestTarget());
    

    which returns something like this (we use it as login callback url) :

    http://192.168.0.57/archive?melkId=12
    

提交回复
热议问题