發表文章

目前顯示的是有「cookie」標籤的文章

在CFSCRIPT下使用Cookie

Coldfusion繼續來玩Cookie吧, 注意下面的操作可能需要 CF9 以上的版本, Railo 3.3 以上的版本執行上沒有問題。 繼上一篇 Using cookie in CFML 之後,如果想在 Cfscript 中使用cookie的操作要怎麼辦? 目前尋遍 adobe 官方文件 得到的結果是: Direct assignment of Cookie scope memory-only variables. You cannot use direct assignment to set persistent cookies that are stored on the user's system. 真是沒輒!! 但是還是有辦法操作的,就是利用 cf-tag 與 cfscript 混用: 首先,寫一段處理 cookie 的 Function : <cffunction name="setCookie" access="public" returnType="void" output="false">  <cfargument name="name" type="string" required="true">  <cfargument name="value" type="string" required="false">  <cfargument name="expires" type="any" required="false">  <cfargument name="domain" type="string" required="false">  <cfargument name="httpOnly" type="boolean" required="false&q

jQuery.cookie 如何讀取 Coldfusion cfcookie 的設定值

圖片
我們都知道在Coldfusion下設定cookie只需要使用 cfcookie tag, 例如我們設定一個cookie名稱叫cid,它的值為123456,有效期為1天: <cfcookie name="cid" value="123456" expires="1"> 如果用coldfusion來讀取這個只需要下: <cfset idvar = cookie.cid> 或 #cookie.cid# 就可以簡單讀取。 但是某些情況下,若是用到了javascript來讀取這個值,就好像不是這麼一回事了,