带括号的ColdFusion变量名称 [英] ColdFusion Variable Name with brackets
问题描述
我正在使用一个webhook进行交互,它提供了一个FORM结构,其中包含括号 []
的几个变量。如何在CFML中使用这些变量?
I'm interacting with a webhook which provides a FORM struct with several variables containing brackets [ ]
. How can I utilize these variables within CFML?
示例:
Example:
FORM.PAYLOAD[SITE][ID]
FORM
是结构
PAYLOAD [SITE] [ID]
是 FORM
struct。
FORM
is the struct
PAYLOAD[SITE][ID]
is the name of the variable within the FORM
struct.
所有帮助非常感谢!
推荐答案
I宁愿建议你使用 cfdump
来转储表格
结构,像这样 -
I would rather suggest you to dump the form
struct using cfdump
like this-
<cfdump var = "#form#" />
并查看是否 PAYLOAD [SITE] [ID]
是 form
结构的关键,或者只有有效载荷
是关键。
and see if PAYLOAD[SITE][ID]
is a key of form
struct or only payload
is the key.
如果整个 PAYLOAD [SITE] [ID]
作为转储中的键出现,则可以使用像这样的变量, -
If the whole PAYLOAD[SITE][ID]
appears as a key in the dump, then as @matt suggested, you can utilize the variables like this-
<cfset payload_site_id = form["PAYLOAD[SITE][ID]"] />
这篇关于带括号的ColdFusion变量名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!