You are viewing documentation for v1.1.x. Change

flash()

Description

Returns the value of a specific key in the Flash (or the entire Flash as a struct if no key is passed in).

Function Syntax

flash([ key ])

Parameters

Parameter Type Required Default Description
key string No The key to get the value for.

Examples

<!--- Display "message" item in flash --->
<cfoutput>
    <cfif flashKeyExists("message")>
        <p class="message">
            #flash("message")#
        </p>
    </cfif>
</cfoutput>

<!--- Display all flash items --->
<cfoutput>
    <cfset allFlash = flash()>
    <cfloop list="#StructKeyList(allFlash)#" index="flashItem">
        <p class="#flashItem#">
            #flash(flashItem)#
        </p>
    </cfloop>
</cfoutput>