Coldfusion 8:IsDefined('URL.variable')并且不是""?

dco*_*bus 6 coldfusion coldfusion-8

我试图找出url变量是否存在,如果不存在,请确保它不是空的.

这不起作用:

<cfif IsDefined('URL.affiliateId') and is not "">
    //
</cfif>
Run Code Online (Sandbox Code Playgroud)

scr*_*ler 15

<cfif structKeyExists(url, 'affiliateID') and trim(url.affiliateID) neq "">...</cfif>
Run Code Online (Sandbox Code Playgroud)

  • 此外,它已被证明sturctKeyExists比IsDefined更有效. (2认同)