问题
For example I have the following bit of code:
<cfhttp url="FileURL" method="get" result="HTTPResult" timeout="5" />
And I want to do this:
<cfoutput>
#HTTPResult.ResponseHeader.content-type#
</cfoutput>
However ColdFusion will see the dash -
as an operator and try to subtract variables "HTTPResult.ResponseHeader.content" from "type", and neither exists. Is there a direct way to access the "content-type" variable or do I need to jump through hoops to fetch it out of the header variable?
回答1:
HTTPResult.ResponseHeader["content-type"]
来源:https://stackoverflow.com/questions/6312226/how-to-access-a-variable-name-in-coldfusion-that-contains-a-special-character