注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿飘的博客

十里平湖霜满天 寸寸青丝愁华年

 
 
 

日志

 
 

php session_unset与 session_destroy的分别  

2010-06-02 13:17:11|  分类: php |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

session_unset()
释放当前在内存中已经创建的所有$_SESSION变量,但不删除session文件以及不释放对应的session id

session_destroy()
删除当前用户对应的session文件以及释放session id,内存中的$_SESSION变量内容依然保留

因此,释放用户的 session所有资源,需要顺序执行如下代码:
程序代码
<?php

session_start();
$_SESSION['user'] = 'lowell';
session_unset();
session_destroy();
?>

  评论这张
 
阅读(958)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

tl=lee> sessiogass='top stylfidth="100%th="100%et=order="0" scrolbloe="125:10w:hi+齦#d5d5d5;bom/gr7">d:#ffffe1
要抢div> ="yin:10px 最近读者adding:0 0 0 10px;line-height:30px; hide087086 ="125" = tylet="0" i"> 八招诀lmiddlead" style="nt prigity:hidnt prigy:none" clac an>人譼 d lass7087086src=s0">历095s.p={ m:2,s0">历史上的nt pb:2,s0">历史上的nt p" taPerm">詎k:'',s0">历史上的nt pid:'67087087085067" /> 历史上的nt p 历史上的nt p comt:' \n簧境齭ession文件以及不释放对应的session id

session_destroy()
删除当前用户对应\> \nn id,内存中的$_SESSION变量内容依然保留

因此,释放用户的 session所有资源,需要薥> <?php

session_start(\>
$_SESS\> "hidser'] =\ '\ssion文件ell';<ion\> sion_unset\> ses\sion_\n\estroy(\); ;<br> ?&amion\> ;<br& bw-b\> g-end"><\>',s0">历史上的nt p 历史上的nt p ',s0">历史上的nt pisPubv> hed:1,s0">历史上的nt pi博縫:fa ,s0">历史上的nt p3%E9:0,s0">历史上的nt pmone"y :0,s0">历史上的nt p嫉絃OFT : 5455820155,s0">历史上的nt p m">詎k:' ',s0">历史上的nt p |block:0,s0">历史上的nt pass=Civ> block:0,s0">历史上的nt pe> block:0,s0">历史上的nt pbsrk:-scr,s0">历史上的nt p ubv> herId:0,s0">历史上的nt pe> B历史上的nt pcurd('bR> B历史上的nt pat隳胔> sF>历史上的nt p:{},s0">历史上的nt pgr7"p历史上的nt p

  • 历史上的nt pnbsp; ow',s0">历史上的nt p嫉絊ucc:'',s0">历史上的nt phidd"trProvince:'',s0">历史上的nt phidd"tr y:'',s0">历史上的nt phidd"trNew 历史上的nt pype=Add历史上的nt pmp;<:'rge',s0">历史上的nt pmowt:'',s0">历史上的nt psrk:-scr,s0">历史上的nt preersdgoodnlowt 历史上的nt pisBlom/Vidd"tr:fa ,s0">历史上的nt pis Yy:noAd:tru ,s0">历史上的nt p 历史上的nt phmowt:'1',s0">历史上的nt pD%9fR> B历史上的nt p" targ_ gle:'ht="745"der="0"1no" allowtra56parx;displ4 class="bdwb bds2rl=http://le1023_04"> E精选tic/ 历史上的ntcript譼 d lass7087086sr
    nbsp; fcclas> fno"=s0">历 hide" id="$_ om/se="border:none;" left;margin-left:1mg sty150109_ 历史{if x.hidd"trN870==hidd"tr. sesN870}s0">历史s/micaltra${x.hidd"trN re0870|escape}" r.crror><095s.rl=h
    .fno"e margincwd Updds2 }"e="from" v{ cript> hi/micaltra${x.hidd"trN re0870|escape}" r.crror><095s.rl=h
  • .fno"e margincwd hi/div> "> cwd v0870"nb - s0">历史 {if x.om/eFnpu==' 'cript> hnt pidefocus="om/se e="border:none;" le100&type=2&u /span> { if x.om/eFnpu=='ipa ce'cript> hnt pidefocus="om/se e="border:none;" /span> { if x.om/eFnpu=='lofroid'cript> hnt pidefocus="om/se e="border:none;" /span> { if x.om/eFnpu=='moen;e'cript> hnt pidefocus="om/se e="border:none;" "_blank" hidef /span> { h pidefocus="n>人
    历史nt p${fn(x.hidd"trN re0870,8)|escape}s0">历史 pi/div> dity:hidnt piity:hidnt p{ { stcript譼 d lass7087086sr
    <095s.rl=h
    .f6parxl=le${fn1(a. sesN870)}"e=i/div> idem/sharetext?act=" id="$_ div>"_blank" hidef iy:none" claibsrihaos信&${ %9fI精裲|escape}{if gasst260}${sufix> }{ mbga l"blog-163-cov"> mbga6.ninkBottomDiv" class='todefocus="n>人 l"
    pi/y:n s0">历{ 譼 d#--最新jsc",="_jsc"ebapp pi lass7087086sr
    历{v> a as xcript> {if !!xcript> "ss="i i1 fnb - idem/sharetext?act=" id="$_ div>"_blank${f485()}${x. m">詎k}/?bds2stB譼 d#--:nonjsc"ebapp pi lass7087086sr
    刃&:non过这篇jsc"的人TagIdiv> y:n s0">历 {v> a as xcript> {if !!xcript> ov"> nbsp; fcclas> fno"=s0">历 hov"defocus="n>人 om/se="border:none;" left;margin-left:1mg sty150109_ esN870}-- s0">历史ov"/micaltra${x.e> esN re0870|escape}" r.crror><095s.rl=h
    .fno"e margincwd esN870)}"e=s0">历史 pi/div> ov"> cwd nb - s0">历史 ov"defocus="n>人 div>"m/sharetext?act=m "_blank" hidef < =erN870}-- s0">历史ovnt p${fn(x.>< =erN/le0870,6)|escape}s0">历史 pov"/div> ov"/y:n s0">历 "/y:n s0">历 { 历{if !!b&&b.length>0cript> ip e marginn>刃&他们还:non了TagIdiv> teriframe{v> b as ycript> h{if !!ycript> hov"ss="i i1 frrb- i t" id="$nbsp;<.ni#183cla nbw-tdefocus="n>人 div>"m/sharetext?act=m100&type=2&u < =B詎k}/?inpu> a ${y">< =B { stcriptov"/teriframe{ 譼 d#--引用糹cnebapp pi lass7087086sr
    &n>-wr/div糹cnTagInfo">s0">历< /h1s0">历{v> d as xcript> ov"ss="i i1 fss="phide"s0">历史 pi t" id="$fix"> <.ni#183cla nbw-s0">历史 piy:none" clat < nb fix">- i com/selection?id=122" id="$_ 7
    历 ov"y:none" clat dRes="bloi com/selection?id=122" id="$_ 7
    譼 d#--博主:nonebapp pi lass7087086sr
    詎k}/?>< =B { stcript譼 d#--随机历{v> a as xcript> {if !!xcript> "ss="i i1 fnb - idem/sharetext?act=" id="$_ div>"_blank150109_ 詎k}/? crialR> B { stcript譼 d#--="w :nonebapp pi lass7087086sr
    历{v> a as xcript> {if !!xcript> "ss="i i1 fnb - idem/sharetext?act=" id="$_ div>"m/sharetext?act=m100&t${x. < =p fcfaxia-bkico${x. { stcript譼 d#-- ztag clearfebapp pi lass7087086sr
    历< s0">历史{v> a as xcript> {if x_ >4}{bassk}{ 历史{if !!xcript> nt piss="i i1 fnb an>人历史nt pidefocus="div>"m/sharetext?act="_blank" hidef 詎k|defa"ti:""}" ="-bkico${x.f-bki|defa"ti:""|escape}a ${fn1(x."-bki,60)|escape}i/di t" id="$n>-wr${fn2(x.嫉絃OFT ,'yyyy-MM-dd HH:mm:ss')}>
    { stcriptov"/ s0">譼 d#--被:nonjsc"ebapp pi lass7087086sr
    詎k}/a ${fn(x."-bki,26)|escape}i/di
    譼 ov"#--上一篇,"fc0篇ebapp pi lass7087086sr
    詎k)cript> h博 il 历史n"y:none" clafix">&nb - ide" id="$div>""_blank" hidef05211711305&w=100&h=1${ 詎k}-- ${ 历 { {if !!( 詎k)cript> h博 irg

    s0">历史n"y:none" claf nb - ide" id="$div>"mg sty150109_05211711305&w=100&h=1${ 詎k}-- ${ 历 { 譼 d#-- nt cwebappov" lass7087086sr
    历{v> a as xcript> {if !!xcript> "y:none" clas2 fcclas> fno"=s0">历 hide" id="$_ om/se="border:none;" left;margin-left:1mg sty150109_ 历史{if x.嫉絃OFTer 历史s/micaltra${x.嫉絃OFTerN re0870|escape}" r.crror><095s.rl=h
    .fno"e margincwd Updds2 }"e="from" v{ cript> hi/micaltra${x.嫉絃OFTerN re0870|escape}" r.crror><095s.rl=h
    .fno"e margincwd hi/div> "> cwd v0870"nb - s0">历史 "defocus="n>人 div>""m/sharetext?act=m "_blank" hidef 历史nt p${fn(x.嫉絃OFTerN re0870,8)|escape}s0">历史nv"/div> "/y:n s0">历 "defocus="nspanRecommends2 3%E9 {if x.3%E9%=1} js-an> 3%E9{ if x.3%E9%=2} js-span> 3%E9{ if x.3%E9%=3} js- %E9{ }{ 历{ { stcript譼 s0">"#-- h="2新闻广告 webappov" lass7087086sr
    h="2新闻"/y:n s0">历 ppppppp"y:none" claarfs s0">历史 ppppppppp"defocus="h fcarfs>"_ "m/sharetext?act=m100&t${h fc"ples.485_3w|escape} s0 13:17:11<"/micrl=ht${/misize(h fc"ples./misrc, ,las,tru )}" s0 13:17:11<" t" id="$ic4 cli nbw-s0 13:17:11<" t" id="$ispan c t" id="$img 罩< a ${h fc"ples."-bki|escape}la nbw-t nbw-s0 pppppppi/dis0 pppppppi s0 ppppppp {if defpled('arfsv> ')&pan>sv> .length>0cript> ppppppp ppppppp{v> an>sv> as xcript> ov ppppppp ppppp{if x_ >7}{bassk}{ s略-- ht fh="2新闻t="Ф> s0 ppppppp"/y:n s0">历 ppppppp"/y:n s0">譼 s0">"#--右边模块结构ebapp pi lass7087086tx
    -s="c lt < 嬷幸丫:nonjsc":hidden ppp" ds0 bbl s0">历adding:0 0 n>-s="c lt < 嬷幸丫钚耲sc":hidden ppp" ds0 bbl s0">历adding:0 0 n>-s="c lt < 嬷幸丫米髡叩钠渌鹒low:hidden ppp" ds0 bbl s0">历adding:0 0 n>-s="c lt < 嬷幸丫┲:non:hidden ppp" ds0 bbl s0">历adding:0 0 n>-s="c lt < 嬷幸丫婊历adding:0 0 n>-s="c lt < 嬷幸丫="w :non:hidden ppp" ds0 bbl s0">历ay:none" cla alli :lm/sharetext?act=" id="$_ g/#m=0&t=1&c=fks_080 overdiv>div> ="yin: ppp"bre=ibre=s0">历"y:noecom 历"y:noecom cAcc7">|譼 "#--) >
    s0">历史"y:none" clac5&l y:n=s0">历pp"y:none" class="phide" y:n=s0">pp" y:n=s0">譼 "#--引用模块结构ebapp pi lass7087086="t="125" 02stx -信 & "y:none" claclo&l s0">历史ni t" id="$ds0 bnbsp; y:n=s0">譼 pp"#--博主发起的投票ebapp pi lass7087086="t="125" 02stx -3- s0">历{v> a as xcript> {if !!xcript> pp".16s0">历史 :le100&type=2&u 人历史 { if(fire="opslogon_tru ;cript> h {v> x.h/a>D L> as h/a>ToOpslogcript> h pppp{if h/a>ToOpslog==1}s0">历史 pppppp{if fire="opslog==fa },{ ToOpslog_ ]}”inkBotinkBots0">历史 pppp{ pppp{ stcriptpppppp{if (x.me>e!="-信) },“我是${c[x.me>e]}”inkBotinkBot{ ppppinkBotinkBotinkBotinkBoti t" id="$n>-wrinkBotinkBotinkBotinkBot${fn1(x.h/a>T )}>
    {if x. sesN870==''}{ 历{ { stcript" y:n=s0 edItems"> /"; //flow的永久链接,作为flow的 pppp"y:none" clale m hnsparinkBottoy:n=s0">历pp"y:none" clar cr hnsparinkBottoy:n=s0">历" y:n=s0pppp"y:none" clasc">b 历史"y:none" clale < bfoninkBot" y:n=s0pppppp"y:none" clar bc bhoninkBot" y:n=s0pppppp"y:none" clas="s="h 历pp"y:none" clal t ltoninkBot" y:n=s0pppppp"y:none" clal b 历pp"y:none" claf("y:none" clasc"laslas-smb- iy:none" clawkg h nbcl iy:none" clam h- inkBot" y:n=iy:none" clar h- inkBot" y:n=iy:none" clac h- inkBot" y:n=i y:n=" y:n=s0iy:none" clasc"laslas-f s0">iy:none" clawkg h s0">历

    页 h2>s0">历iy:none" clak">pppppp :lb b nbsp;<"e margindivan>8;"m/sharetext?act=e100&type=2&u

    i/dis0pppppp t" id="$c07"1o"=- nbw-s0pppppp :lb b nbsp;<"e margindivan>8;"m/sharetext?act=e100&type=2&u -- 博客风格i/dis0pppppp t" id="$c07"1o"=- nbw-s0pppppp :lb b nbsp;<"e margindivan>8;"m/sharetext?act=e100&type=2&u get="_bli/dis0pppppp t" id="$c07"1o"=- nbw-s0pppppp :lb b nbsp;<"e margindivan>8;"m/sharetext?act=e100&type=2&u1023_04"> 略豅OFTER历史".1nkob b altc 
    禿iva┰

    8;> 此博客i/di nbw-s0pppp" y:n=s0pppp"line-heign>8wrh="2公司版权 " y:n=s0" y:n=" y:n=s0pppp"!--[if lt< IE 6] y:n=pp" lass7rows=" clhtts=" cl0870="="t="125"as-="t-a信&pp":lb b nbsp;<"e marginpalim/sharetext?act=e100&type=2&uhelp3 dis0譸p" lass7rows=" clhtts=" cl0870="="t="125"as-="t-do"=pppppp{v> as xcript> pppp"y:none" clagrpa ${x.g}> y:n>s0">历pppp{v> x. as ycript> hov"defocus=" om/se=e100&tle=_ "0870="{if 3%E9of(y.v)=='> c g'}${y.v}{ c${y_ }{ dis0pppppppp{ stcriptpppp{ stcri譸p" lass7rows=" clhtts=" cl0870="="t="125"as-="t-d信& {if defpled('wl')}s0">历史pp{v> as xc"defocus=" om/se=e100&tle=_ "0870="${x.v}a ${x.n}> di{ stcripppp{ > y:n>s0 edItems">
    s0">w ow.Non_{tm:{'z ':'e ',s0">历史上的nt ppppp'bdc0':'bdc0','bdc2':'bdc1',s0 1 p'clas':'blas','bgc1':'bla1','bgc2':'bgc2','bghs':'bla9',s0 1 p'n>萻':'n>3','n>1':'n>4','n>2':'n>5','n>3':'n>6','n>4':'n>7','n>5':'n>9'}};s0">Dds2 %rvT on_'06/23/hid7 02:25:15';s0">
    .apion_'150109_api.
    .msgon_'150109_api.
    .gLinn_'150109_api.
    .vcdnn_'150109_api.
    .mrtnn_'150109_b />
    .fccln_'150109_os. mon/ rait/fbcl/t与view/';s0">
    .f60ln_'150109_b /> mon/fbcl60.
    .f1non_'150109_b /> mon/fbcl1no.
    .f
    .adf1non_'150109_b /> mon/admi100bcl1no.
    .eptnn_'150109_b /> mon/ pty.
    .gu _protioe_addn_'150109_b /> mon/gu _protioe_add.gif';s0">
    .pTERto_dassmln_'150109_pa to.dassm3 w ow.CFln_{s0">历ca:fa s0">," h:-3s0">,cb:''s0">,cc:fa s0">,cd:fa s0">,ce:'-3's0">,ck:0s0">,ci:['api. 历史,'150109_pa to. 历史-blog-start,'ud. 历史-blog-starts0">纏pppps0">纏pppp]s0">,cj:[-3]s0">,ct:t's0">,cm:[""," ,cf:0s0">,ca:{pv:fa s0">纏ppp,ti;分1558889s0">纏ppp,tt:''s0">纏ppp,tc:0s0">纏ppp,tl:3s0">纏ppp,ut:0s0">纏ppp,ut:''s0">纏ppp,um:''s0">纏ppp,ui:0s0">纏ppp,ud:tru }s0">,cp:{nr:2s0">纏ppp,cr:2s0">纏ppp,vr:-scrs0">纏ppp,fr:0cript>,cs:0s0">,ct:{'nav':['="w ','jsc"','相册','音乐','收藏','博友','关于我','th:100'],'enabled':[ ,l,6],'defa"tinav':plaseI精('11111111',2)}s0">,cu:fa s0">,cv:fa s0">,cw:fa s0">};s0">w ow.UDln_{};s0">UD. 历 sesId:xtj_2015s0">纏p, sesN870:'0521171's0">纏p,//leN870:'n" n's0">纏p,an> Updds2 :-ss0">纏p,b5&l/st:'150109_05211711305&w=100&h=1's0">纏p,g 纏p,e :'0521171 纏p,pa to N870:'0521171's0">纏p,pa to H 纏p,TOKEN_HTMLMODULE:''s0">纏p,isM"tit ppp,isW/di 纏p,sRank:-scrs0">};s0 edItem6s0pppp edItems"> edItem6s0pppp edItems"> edItem6s0pp edItemsrl=http://leaialy s3 edItem6s0pp edItems3%E9%" /ja cedItem> s0">纏_bsps_nacc=tNode'; e5&lTcomkerv> s0">纏s0">纏an> blog/().rl=ln_'150109_ aialyse. Dds2().getT v> s0"> edItem6s0 edItem>s0w ow.p;(funbblog(i,s,o,g,r,a,m){i['GoogleAialy sObjebb']=r;i[r]=i[r]||funbblog(){s0">(i[r].q=i[r].q||[]).嫉sh(argu> s)},i[r].l=1*an> Dds2();a=s.cassteEix> (o),s0">m=s.getEix> sByassN870(o)[0];a.async=1;a.rl=hg;m.plasntNone.isp;rtBe e(a,m)s0">})(w ow,docu> ,'edItem','//1023google-aialy s3 /aialy s3js','ga'> s0s0">ga('casste', 'UA-692049 -1', 'fc0o'> s0">ga('s ', 'pwidview'> s0},300> s0s0s0s0 edItem6-bls0s0 edItem 3%E9%" /ja cedItem> s0">纏w ow.p; s0 1s0 1J.ype=DdsaByDWR( c s0 },2050> s0 edItem6bls0s0 edItem>s0w ow.p; rwww.iptnn_docu> .cassteEix> ('edItem'> s0ppppww.ipt.asyncln_1 s0ppppww.ipt.rl=ln_'150109_ 1 /> regass=/b s/js/ docu> .body.略 Child(ww.ipt> s0pppp },300> s0s0 edItem6-blog-s edItems3%E9%" /ja cedItem>croblo/an>pwid/t与 3%log./t与tte"y.js edItem6s0s0 html>s0