开发者

Convert A String To A Variable in Coldfusion

开发者 https://www.devze.com 2023-02-10 23:50 出处:网络
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\

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]>
0

精彩评论

暂无评论...
验证码 换一张
取 消