我疯了,试图弄清楚如何阅读cfhttp.responseHeader
. 我正在尝试访问一个在响应中发送几个 cookie 的网站。我需要从响应中提取它们。然后将 cookie 值与所有未来请求一起发送。我尝试使用以下代码:
<cfloop collection = #cfhttp.responseHeader# item = "httpHeader">
<cfset value = cfhttp.responseHeader[httpHeader]>
<cfif IsSimpleValue(value)>
<cfoutput>
#httpHeader# : #value#<BR>
</cfoutput>
<cfelse>
<cfloop index = "counter" from = 1 to = #ArrayLen(value)#>
<cfoutput>
#httpHeader# : #value[counter]#<BR>
</cfoutput>
</cfloop>
</cfif>
但这会引发以下错误
Object of type class coldfusion.util.FastHashtable cannot be used as an array
The error occurred in C:/inetpub/wwwroot/cfdocs/Response.cfm: line 22
20 : </cfoutput>
21 : <cfelse>
22 : <cfloop index = "counter" from = 1 to = #ArrayLen(value)#>
23 : <cfoutput>
24 : #httpHeader# : #value[counter]#<BR>