[CMS]有关Cookies、Session、Application在CMS2里的正确使用方法
作者:cmscn 日期:2007-03-07
Cookies的使用方法
写入Cookies
Sub cookies_set(ByVal cookiesname As String, ByVal cookiesvar As Variant)
示例:call joekoe_cms.cookies_set("test","test word")
读取Cookies
Function cookies_get(ByVal cookiesname As String) As Variant
示例:teststr=joekoe_cms.cookies_get("test")
删除Cookies
Sub cookies_del(ByVal cookiesname As String)
示例:call joekoe_cms.cookies_del("test")
相关注意事项
在系统页面重定之前请使用如下语句:
call joekoe_cms.cookies_load()
Session的使用方法
写入Session
Sub session_set(ByVal sessionname As String, ByVal sessionvar As Variant)
示例:call joekoe_cms.session_set("test","test word")
读取Session
Function session_get(ByVal sessionname As String) As Variant
示例:teststr=joekoe_cms.session_get("test")
删除Session
Sub session_del(ByVal sessionname As String)
示例:call joekoe_cms.session_del("test")
Application的使用方法(缓存)
写入缓存
Sub cache_set(ByVal cachename As String, ByVal cachevar As Variant)
示例:call joekoe_cms.cache_set("test","test word")
读取缓存
Function cache_get(ByVal cachename As String) As Variant
示例:teststr=joekoe_cms.cache_get("test")
删除单个缓存
Sub cache_del(ByVal cachename As String)
示例:call joekoe_cms.cache_del("test")
删除一组缓存
Sub cache_delete(Optional ByVal cnv As String = "")
示例:
call joekoe_cms.cache_delete("forum_")
上面这一句将删除所有开头为“forum_”的缓存,如“forum_data”,“forum_tops”等
call joekoe_cms.cache_delete()
上面这一句将删除网站当前使用的所有缓存,在使用时请注意
判断缓存是否存在
Function is_cache(ByVal c_obj As String) as Boolean
示例:
if joekoe_cms.is_cache("forum_data") then
'缓存“forum_data”存在时的操作
else
'缓存“forum_data”不存在时的操作
end if
评论: 8 | 引用: 0 | 查看次数: 693
发表评论