の内容を読む方法を理解しようとしていcfhttp.responseHeader
ます。応答でいくつかの Cookie を送信する Web サイトにアクセスしようとしています。応答からそれらを抽出する必要があります。次に、今後のすべてのリクエストで 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>