我正在用CFWheels框架1.1.8創建一個基於會話的購物車。我遇到了一個奇怪的問題,ColdFusion 9會話沒有持續。我花了無數小時檢查,並仔細檢查我的代碼。我希望新鮮的眼睛能夠發現我錯過的東西。以下是我的代碼的簡化版本。任何建議將非常感激。ColdFusion會話問題
配置/ app.cfm
<cfscript>
this.name = hash(getDirectoryFromPath(getCurrentTemplatePath())
, "SHA-256");
this.applicationTimeout = createTimeSpan(0, 2, 0, 0);
this.loginStorage = "session";
this.sessionManagement = true;
this.sessionTimeout = createTimeSpan(0, 1, 0, 0);
this.setClientCookies = false;
this.setDomainCookes = false;
</cfscript>
活動/ onRequestStart.cfm
控制器/ Cart.cfc
<cfcomponent extends="Controller">
<cffunction name="index">
</cffunction>
<cffunction name="create">
<cfset arrayAppend(session.cart, structNew())>
<cfset index = arrayLen(session.cart)>
<cfset session.cart[index].title = "Product Name">
<cfset session.cart[index].quantity = "1">
<!---
this return the expect cart array with product.
The item disappears once it gets redirected to the index page
--->
<cfdump var="#session.cart#" abort>
<cfset redirectTo(action="index")>
</cffunction>
</cfcomponent>
查看/車/ index.cfm
<!--- this return an empty array (same in all other web page)--->
<cfdump var="#session.cart#">