问题描述
我有一个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
HTTPHTTPS
- 反之亦然,我相信。 / 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 useCONTAINS
orfindNoCase()
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 fromHTTP
toHTTPS
-- and vice-versa, I believe.这篇关于需要帮助理解Coldfusion URL引荐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!