ColdFusion是定义获取未定义错误

aba*_*ter 3 coldfusion

我有:

<cfif not isDefined(activity)>
    <cfset activity="">
</cfif>
Run Code Online (Sandbox Code Playgroud)

我收到错误:"变量ACTIVITY未定义."

咦?

哦,错误是isDefined,而不是cfset.

Ant*_*ony 9

isDefined采用变量的名称,而不是变量本身:

<cfif not isDefined("activity")>
    <cfset activity="">
</cfif>
Run Code Online (Sandbox Code Playgroud)