本文介绍了需要帮助理解Coldfusion URL引荐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ColdFusion网站,我需要根据用户到达网页的方式显示不同的文字。



Ie,

 < cfif user comes from sitemap.cfm> 
显示此文本
< cfelse>
显示此文本
< / cfif>有人能指出我的方向吗?

h2_lin>解决方案

您想要查看CGI环境变量,具体来说 HTTP_REFERER (否,不是拼写错误 - ,我应该说,CGI变量的名称拼写错误。)



我相信 HTTP_REFERER 包含整个URL,包括查询字符串,所以你必须解析它 - 或者使用 CONTAINS findNoCase()< cfif> 语句中:

  ; cfif findNoCase(sitemap.cfm,cgi.HTTP_REFERER)> 
显示此文本
< cfelse>
显示此文本
< / cfif>

重要的是注意 HTTP_REFERER HTTP HTTPS - 反之亦然,我相信。 / p>

I have a ColdFusion site on which I need to display different text based on how the user got to the page.

I.e.,

<cfif user comes from sitemap.cfm>
    Display this text
<cfelse>
    display this text
</cfif>

Can someone point me in the right direction?

解决方案

You want to look at the CGI environment variables, specifically HTTP_REFERER (and no, that isn't misspelled -- or, I should say, the name of the CGI variable is misspelled).

I believe the value of HTTP_REFERER will contain the entire URL, including the query string, so you'll have to parse it -- or perhaps use CONTAINS or findNoCase() in your <cfif> statement:

<cfif findNoCase("sitemap.cfm", cgi.HTTP_REFERER)>
    Display this text
<cfelse>
    display this text
</cfif>

It's important to note that the value of HTTP_REFERER will be empty if you're going from HTTP to HTTPS -- and vice-versa, I believe.

这篇关于需要帮助理解Coldfusion URL引荐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 03:57