基于其价值的Coldfusion重新分配会话变量

时间:2015-04-06 21:22:54

标签: coldfusion

是否可以设置会话变量,然后在等于某个值时稍后更改?

<cfif session.checkout.vehicle.vehiclebody eq "TK1" or "TK2" or "TK3" or "TK4" or "TK5">
<cfparam name="#session.checkout.vehicle.vehiclebody#" default="TK">
</cfif>

我想要做的是,如果会话变量等于TK1,TK2,TK3,TK4或TK5,那么将会话变量重新分配给仅等于TK

那么#session.checkout.vehicle.vehiclebody# is eq to "TK"

非常感谢任何帮助!

1 个答案:

答案 0 :(得分:2)

试试这个:

<cfparam name="session.checkout.vehicle.vehicleBody" default="TK" />
<cfif listFindNoCase("TK1,TK2,TK3,TK4,TK5", session.checkout.vehicle.vehicleBody)>
    <cfset session.checkout.vehicle.vehicleBody = "TK" />
</cfif>