人人做人人澡人人爽欧美,国产主播一区二区,久久久精品五月天,羞羞视频在线观看免费

當(dāng)前位置:蘿卜系統(tǒng)下載站 > 技術(shù)開(kāi)發(fā)教程 > 詳細(xì)頁(yè)面

php4的session技巧評(píng)述(一)

php4的session技巧評(píng)述(一)

更新時(shí)間:2022-07-23 文章作者:未知 信息來(lái)源:網(wǎng)絡(luò) 閱讀次數(shù):

php4比php3新加了session的支持。稍微用了一下,對(duì)其函數(shù)接口,內(nèi)部機(jī)制,  
應(yīng)用的方便性做了大概的了解。  
session的意義大家都應(yīng)該清楚,一個(gè)session可以包括數(shù)次http的請(qǐng)求和應(yīng)答,  
比如我們用163.net,從login到logout或者超時(shí)就作為一個(gè)session,session  
的唯一標(biāo)識(shí)一般是在系統(tǒng)內(nèi)部生成一個(gè)唯一的session ID,一般是一個(gè)挺長(zhǎng)的  
字符串。一個(gè)session除了session ID,還可以有自己的session data,可以  
記錄和區(qū)分sesion的不同狀態(tài)。  
  
php4對(duì)session操作提供以下接口:  
  
session_start — Initialize session data  
session_destroy — Destroys all data registered to a session  
session_name — Get and/or set the current session name  
session_module_name — Get and/or set the current session module  
session_save_path — Get and/or set the current session save path  
session_id — Get and/or set the current session id  
session_register — Register a variable with the current session  
session_unregister — Unregister a variable from the current session  
session_is_registered — Find out if a variable is registered in a session  
session_decode — Decodes session data from a string  
session_encode — Encodes the current session data as a string  
  
意義大家一看就能明白,session_start開(kāi)始一個(gè)session,session_destroy結(jié)  
束一個(gè)session,session_id取得當(dāng)前的session_id,session_register向當(dāng)前  
的session注冊(cè)一個(gè)變量,這個(gè)很有用,比如用戶(hù)逛商場(chǎng),選中了某幾樣商品你  
就可以用session_register把商品名稱(chēng)或者代碼register到當(dāng)前的session中。  
  
比如下面例子(摘自php manual):  
  
<?php  
session_register("count");  
$count++;  
?>  
  
Hello visitor, you have seen this page <? echo $count; ?> times.<p>  
# the <?=SID?> is necessary to preserve the session id
# in the case that the user has disabled cookies

To continue, <A HREF="nextpage.php?<?=SID?>">click here</A>

session_register可以隱式地激發(fā)session_start(如果用戶(hù)之前沒(méi)發(fā)session_
start調(diào)用),當(dāng)前的session注冊(cè)了一個(gè)變量count,每次用戶(hù)點(diǎn)擊click here
的時(shí)候,這個(gè)變量都會(huì)增一。你可以自己試一下。<?=SID?>的意義不多贅述。  

溫馨提示:喜歡本站的話,請(qǐng)收藏一下本站!

本類(lèi)教程下載

系統(tǒng)下載排行

網(wǎng)站地圖xml | 網(wǎng)站地圖html
主站蜘蛛池模板: 康马县| 邯郸市| 福安市| 绥棱县| 南皮县| 林甸县| 大荔县| 黄冈市| 南通市| 饶阳县| 通渭县| 剑川县| 滕州市| 金华市| 宕昌县| 厦门市| 安西县| 镇江市| 霍城县| 锡林浩特市| 安仁县| 嘉义县| 富锦市| 汕尾市| 施秉县| 广平县| 宜昌市| 武宣县| 乌恰县| 巩留县| 墨竹工卡县| 克山县| 岳西县| 都昌县| 广水市| 德清县| 房产| 自治县| 平安县| 上林县| 清水河县|