如何在 cfscript 标签内执行 cfdump? [英] How to do a cfdump inside a cfscript tag?

查看:6
本文介绍了如何在 cfscript 标签内执行 cfdump?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了调试,我想将某些变量转储到我的网页上.我怎样才能从 cfscript 标记中做到这一点?

In order to debug I would like to dump certain variables on to my web page. How can I do that from inside a cfscript tag?

我尝试了以下方法,但它不起作用:

I tried the following but it isn't working:

<cfscript>
  ...
  <cfif cgi.REMOTE_ADDR eq "IP">
    <cfdump var="#var1#"><br/>
  </cfif>
  ...
</cfscript>

关于可以做什么的任何线索?

Any clues on what can be done?

推荐答案

在 CF 9 之前的版本中,您不能直接这样做.但是,您可以使用 dump() 在 CFLib 中找到的 UDF.那里有一整个 UDF 库,它们模仿没有直接 CFSCRIPT 等效项的 CF 标记.

You can't do it directly like that in versions before CF 9. You can, however, use the dump() UDF found at CFLib. There's a whole library of UDFs there that mimic CF tags that don't have direct CFSCRIPT equivalents.

ColdFusion 9(及更高版本)提供 writeDump() 函数.

ColdFusion 9 (and up) offers the writeDump() function.

Adobe 文档链接用于 WriteDump() 函数

Adobe Documentation Linkfor WriteDump() function

这篇关于如何在 cfscript 标签内执行 cfdump?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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