本文介绍了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参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!