本文介绍了ColdFusion Multi Check isDefined(session)并且不为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想说的是,如果这是定义的并且不是空白,请显示此内容.
I am trying to say if this isDefined and is not blank show this..
<cfif (isDefined("session.checkout.info.Certificate_2")) is not "">
我也尝试过:
<cfif (isDefined("session.checkout.info.Certificate_2")) neq "">
有人请告诉我为什么当字符串为空时它仍然显示吗?
Will someone please tell me why this still shows when the string is empty?
推荐答案
考虑使用structKeyExists(它的开销比isDefined低),但是您可以使用:
Consider using structKeyExists (it has lower overhead than isDefined) but here you go:
<cfif
isDefined("session.checkout.info.Certificate_2")
AND session.checkout.info.Certificate_2 NEQ "">
如果存在,将检查是否为空.如果不存在,则不会检查该值.
If it exists it will then check to see if it's empty. If it doesn't exist, it won't check the value.
这篇关于ColdFusion Multi Check isDefined(session)并且不为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!