Contents |
The CFDUMP tag is used to quickly and easily output variable contents to a CFML page. The contents of both simple and complex variables can be dumped.
<cfdump var="#variableToDump#" version="long | short">
| Attribute | Req/Opt | Default | Description |
|---|---|---|---|
| var | optional | N/A | The variable to dump. Note that the variable name must be wrapped in pound signs (#). If the var attribute is not used, CFDUMP dumps variables in all scopes except CGI and SERVER. CGI and SERVER can be dumped explicitly but they are not included when CFDUMP is used without the var attribute. |
| version | optional | depends on variable type | The type of dump to perform. Valid values for the version attribute are LONG and SHORT. The defaults for specific variable types are as follows:
|
CFDUMP provides a quick and easy way to dump the contents of both simple and complex variables, which is very handy for debugging and allows developers to see the contents of variables without having to write loop/output routines themselves.
CFDUMP works with all variable types, but note that when dumping a CFC, the contents of the variables scope is not dumped. Also note that when complex variables are nested inside other variables, for example if a query is a struct member, the version of the dump for the query will be short.
Dump all variables in all scopes other than CGI and SERVER:
<cfdump>
Dump a query object including all records returned:
<cfdump var="#myQuery#" />
Dump high-level information about a query object but do not display all the records returned by the query:
<cfdump var="#myQuery#" version="short" />