如何在ColdFusion中访问包含特殊字符的变量名 [英] How to access a variable name in ColdFusion that contains a special character

查看:81
本文介绍了如何在ColdFusion中访问包含特殊字符的变量名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我有以下代码:

<cfhttp url="FileURL" method="get" result="HTTPResult" timeout="5" />

我想这样做:

<cfoutput>
    #HTTPResult.ResponseHeader.content-type#
</cfoutput>

但是ColdFusion会看到破折号-为一个运算符,并尝试从类型中减去变量 HTTPResult.ResponseHeader.content,并且都不存在。是否可以直接访问 content-type变量,或者我需要跳过箍将其从标头变量中提取出来?

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?

推荐答案

HTTPResult.ResponseHeader["content-type"]

这篇关于如何在ColdFusion中访问包含特殊字符的变量名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆