我正在尝试遍历一个包含我需要显示的列名的数组。用户可以定义自己的列,因此这将是一个动态列名列表
例如,列名可能是:
["style", "color", "size"]
这些是我需要从名为results
.
我正在这样做:
<cfset variables.styleText = "">
<cfloop array="#DeserializeJSON(variables.raw.field_names)#" index="x">
<cfset variables.styleText = variables.styleText & "#results." & x &"# ">
</cfloop>
<cfoutout>variables.styleText</cfoutput>
但这给了我一个错误,因为我不能用quot
aka结束变量名
Diagnose: A CFML variable name cannot end with a "." character.
The variable results. ends with a "." character.
You must supply an additional structure key or delete the "." character.
问题:
谁能给我一个提示,results
在这种情况下,我需要如何修改它以输出查询中
的值#results.style# #results.color# #results.size#
?
谢谢!