用户登录
用户注册

分享至

如何获取 Cakephp 的完整当前 url

  • 作者: Ashark
  • 来源: 51数据库
  • 2023-02-02

问题描述

如何在 Cake 的视图中回显当前 URL?

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

推荐答案

你可以做任何一个

来自视图文件:

<?php echo $this->request->here() ?>">

哪个会给你来自主机名的绝对网址,即/controller/action/params

Which will give you the absolute url from the hostname i.e. /controller/action/params

<?php echo Router::url(null, true) ?> 

它应该为您提供带有主机名的完整网址.

which should give you the full url with the hostname.

软件
前端设计
程序设计
Java相关