本文介绍了ColdFusion:按名称获取 url 参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 ColdFusion 10 中从 CGI.QUERY_STRING
的名称中获取一个 URL 参数.如何做到不循环?
I want to get in ColdFusion 10 an URL parameter from CGI.QUERY_STRING
by its name. How to do it without looping?
推荐答案
任何通过查询字符串传入页面的值在 URL 范围内都可用.
Any values passed in to a page via the query string are available in the URL scope.
假设您有一个类似于 http://mydomain.com?val1=42&val2=moo
的查询字符串,您将通过引用它们来访问变量
Assume you have a query string that looks like http://mydomain.com?val1=42&val2=moo
you would access the variables by referencing them as such
<cfset myVal1 = url.val1 />
<cfset myVal2 = url.val2 />
或者,在 cfscript 中
Or, in cfscript
myVal1 = url.val1;
myVal2 = url.val2;
要查看通过查询字符串传入的所有值,您还可以转储出 URL 范围.
To see all the values passed in via query string, you can also dump out the URL scope.
<cfdump var="#url#" />
或者,在 cfscript 中
or, in cfscript
writeDump( url );
这篇关于ColdFusion:按名称获取 url 参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!