【问题标题】:Joomla getting Variables passed in URLJoomla 获取在 URL 中传递的变量
【发布时间】:2013-04-15 20:06:18
【问题描述】:

当它们被传递到我们的站点时,我试图从 Joomla 中的 URL 字符串中提取值。一个例子是:

?source=SEARCH%20&utm_source=google&utm_medium=cpc&utm_term=&utm_content={creative}&utm_campaign=&cpao=111&cpca=&cpag=&kw=

因此,我希望抓取 VAR=utm_source、utm_medium 等。

我想在网站上携带这些值,并至少在访问者点击表单提交之前保持这些值,这样这些值将与表单一起传递,以跟踪这些区域以查看它们来自哪里、使用了哪些关键字等。

任何帮助将不胜感激。

【问题讨论】:

    标签: php joomla url-rewriting


    【解决方案1】:

    要获取 URL(和 POST)值,您可以使用 JRequest 或 JInput。 JRequest 已被 Joomla 3.0 弃用,因此更好地使用 JInput :-) 请求:http://docs.joomla.org/Retrieving_and_Filtering_GET_and_POST_requests_with_JRequest::getVar J输入:http://docs.joomla.org/Retrieving_request_data_using_JInput

    Joomla 还可以将值存储到用户会话中。如果您想在多个页面上跟踪某些内容,或者想保留用户所做的某些设置(如排序),这很方便。这些被称为 UserStates,文档在这里:http://docs.joomla.org/How_to_use_user_state_variables

    【讨论】:

      猜你喜欢
      • 2013-01-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多