ColdFusion: get url parameter by name

后端 未结 1 458
情话喂你
情话喂你 2020-12-10 14:20

I want to get in ColdFusion 10 an URL parameter from CGI.QUERY_STRING by its name. How to do it without looping?

相关标签:
1条回答
  • 2020-12-10 14:49

    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 );
    
    0 讨论(0)
提交回复
热议问题