How to get complete current url for Cakephp

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

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

24条回答
  •  长情又很酷
    2020-12-08 00:40

    Getting current URL for CakePHP 3.x ?

    In your layout :

    request->here();
        $canonical = $this->Url->build($here, true);
    ?>
    

    You will get the full URL of the current page including query string parameters.

    e.g. http://website.example/controller/action?param=value

    You can use it in a meta tag canonical if you need to do some SEO.

    
    

提交回复
热议问题