【问题标题】:Read current URL or URL variable in joomla [duplicate]在 joomla 中读取当前 URL 或 URL 变量 [重复]
【发布时间】:2014-06-02 17:45:42
【问题描述】:

我正在使用 joomla 2.5。我正在尝试在 Joomla 组件自定义中读取 URL 变量或完整 URL。

我可以读取如下 URL:

http://xyz/index.php?option=com_xyz&format=raw&tmpl=component&lang=en

但我想阅读浏览器上的网址(带别名):

http://xyz/en/feedback?ID=123456&Email=abc@hotmail.com

feedback 是 Joomla 别名。我正在使用另一个 PHP 脚本中的变量重定向该 URL。

如果我尝试:

$_SERVER['HTTP_REFERER'];  // not working in IE.

$_SERVER['QUERY_STRING'] //return com_xyz&format=raw&tmpl=component&lang=en

JRequest::getVar('Email'); // return NULL but works if try getVar('lang'); 

有没有其他解决方案或更好的方法?

【问题讨论】:

  • @felipsmartins 没有找到更多信息,你能解释一下吗。试过但同样的结果没有得到变量值。
  • @felipsmartins :- 没有意义,它们都是不同的问题。
  • 你想做什么,因为你的问题不清楚。
  • 想用别名和变量读取 URl

标签: php url joomla joomla2.5 http-referer


【解决方案1】:

尝试使用以下内容。可能是您正在寻找的:

$url = JUri::current();
echo $url;

使用 Javascript,您可以这样使用:

document.location.href

【讨论】:

  • :- got //xyz/index.php?option=com_xyz&format=raw&tmpl=component&lang=en 但是想再买一个,
猜你喜欢
  • 1970-01-01
  • 2019-03-25
  • 2012-08-26
  • 2011-10-22
  • 1970-01-01
  • 2015-05-06
  • 2012-06-02
  • 1970-01-01
  • 2013-04-11
相关资源
最近更新 更多