Convert A String To A Variable in Coldfusion
I am using a cfloop to generate the titles of a bunch of variables.
Problem is on output I just get the actual variable name ie #qQuery.varName# instead of its value ie "Item N开发者_运维知识库ame".
Heres a quick taste of my code:
<cfloop query="qQuery">
<cfloop query="qTest">
<cfset varTest = "qQuery." & varName>
<cfoutput>#varTest#</cfoutput>
</cfloop>
</cfloop>
Thanks :)
Try something like this:
<cfset vartest = qQuery[varName]>
精彩评论