亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

php4的session功能評(píng)述(一)

 更新時(shí)間:2006年10月09日 00:00:00   作者:  
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è)很有用,比如用戶逛商場(chǎng),選中了某幾樣商品你  
就可以用session_register把商品名稱或者代碼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(如果用戶之前沒(méi)發(fā)session_
start調(diào)用),當(dāng)前的session注冊(cè)了一個(gè)變量count,每次用戶點(diǎn)擊click here
的時(shí)候,這個(gè)變量都會(huì)增一。你可以自己試一下。<?=SID?>的意義不多贅述。  

相關(guān)文章

  • 分頁(yè)顯示Oracle數(shù)據(jù)庫(kù)記錄的類之二

    分頁(yè)顯示Oracle數(shù)據(jù)庫(kù)記錄的類之二

    分頁(yè)顯示Oracle數(shù)據(jù)庫(kù)記錄的類之二...
    2006-10-10
  • 繁體中文轉(zhuǎn)換為簡(jiǎn)體中文的PHP函數(shù)

    繁體中文轉(zhuǎn)換為簡(jiǎn)體中文的PHP函數(shù)

    繁體中文轉(zhuǎn)換為簡(jiǎn)體中文的PHP函數(shù)...
    2006-10-10
  • 十天學(xué)會(huì)php之第四天

    十天學(xué)會(huì)php之第四天

    十天學(xué)會(huì)php之第四天...
    2006-10-10
  • 計(jì)算2000年01月01日起到指定日的天數(shù)

    計(jì)算2000年01月01日起到指定日的天數(shù)

    計(jì)算2000年01月01日起到指定日的天數(shù)...
    2006-10-10
  • PHP4 與 MySQL 交互使用

    PHP4 與 MySQL 交互使用

    PHP4 與 MySQL 交互使用...
    2006-10-10
  • 最新評(píng)論