I want to get in ColdFusion 10 an URL parameter from CGI.QUERY_STRING
by its name. How to do it without looping?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Any values passed in to a page via the query string are available in the URL scope.
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 />
Or, in cfscript
myVal1 = url.val1;
myVal2 = url.val2;
To see all the values passed in via query string, you can also dump out the URL scope.
<cfdump var="#url#" />
or, in cfscript
writeDump( url );