Я использую переменные сеанса в Coldfusion 2018, и я пытаюсь выяснить, как добавить переменную в соответствии с настройкой операторов if if.
<cfif isDefined("session")
and structKeyExists(session, 'checkout')
and structKeyExists(session.checkout, 'info')
and structKeyExists(session.checkout.info, 'andor_1') >
<cfif session.checkout.info.andor_1 eq "And">
<strong>- All signatures are required.</strong>
</cfif>
</cfif>
or
<cfif isDefined("session")
and structKeyExists(session, 'checkout')
and structKeyExists(session.checkout, 'info')
and structKeyExists(session.checkout.info, 'bandor_1') >
<cfif session.checkout.info.bandor_1 eq "And">
<strong>- All signatures are required.</strong>
</cfif>
</cfif>
Операторы if почти идентичны andor_1
или bandor_1
, но любой из них может существовать не всегда, поэтому я использую isDefined.
Я пытался использовать ||
и or
.
<cfif isDefined("session")
and structKeyExists(session, 'checkout')
and structKeyExists(session.checkout, 'info')
and structKeyExists(session.checkout.info, 'andor_1')
|| isDefined("session")
and structKeyExists(session, 'checkout')
and structKeyExists(session.checkout, 'info')
and structKeyExists(session.checkout.info, 'bandor_1')>
<cfif session.checkout.info.andor_1 eq "And" || session.checkout.info.bandor_1 eq "And">
<strong>- All signatures are required.</strong>
</cfif>
</cfif>
Любая помощьСочетание этих cfifs
будет с благодарностью.