绠杩癱ookie鍜宻ession鐨勫尯鍒強鍚勮嚜鐨勫伐浣滄満鍒讹紝鍌ㄥ瓨浣嶇疆绛夛紝绠杩癱ookie鐨勪紭缂虹偣銆
鎵撲竴涓瘮鏂癸紝鐢ㄦ埛鍘昏秴甯備拱涓滆タ锛岀劧鍚庡姙鐞嗕簡涓寮犱細鍛樺崱锛岄偅涔堣秴甯傚氨鍙互鐞嗚В涓烘湇鍔″櫒锛岀敤鎴峰彲浠ョ悊瑙d负瀹㈡埛绔紝鑰屼細鍛樺崱灏卞彲浠ョ悊瑙d负cookie锛屼細鍛樺崱閲岄潰瀛樺偍鐫鐢ㄦ埛淇℃伅銆
鍐 setcookie($name,$value,$expire,$path,$domain,$secure)
璇 $_COOKIE
瀛樻暟缁 setcookie(‘a[b]’,’val’)
鍒犻櫎 setcookie($name,”,time-1000)
浼樼偣锛氫笉浼氬崰鐢ㄦ湇鍔″櫒璧勬簮锛屾晥鐜囬珮
缂虹偣锛氫笉寤鸿灏嗘晱鎰熶俊鎭瓨鍌ㄥ湪cookie锛岀敤鎴峰彲浠ョ鐢╟ookie锛屽垯鏃犳硶淇濆瓨鐢ㄦ埛淇℃伅
杩樻槸鍘昏秴甯傦紝瓒呭競缁欑敤鎴峰姙浜嗕竴寮犵數瀛愬崱锛屾瘡娆″彧闇瑕佽鏄庣敤鎴风殑浼氬憳鍗″彿鐮侊紝鎴栬呮槸鎵嬫満韬唤璇佷粈涔堢殑锛岄偅涔堣繖涓韩浠借瘉灏辩浉褰撲簬SessionID
鍥犱负鏈夊彲鑳藉鎴风浼氱鐢╟ookie锛屾墍浠ュ彲浠ラ氳繃鍦╱rl涓婃嫾鎺ワ紝濡
<a href="1.php?<?php echo session_name().'='.session_id();?>"></a>
鎴栬呮洿绠鍗曠殑鏂规硶
<a href="1.php?<?php echo SID;?>"></a>
鑰屼笖SID鍙湁鍦╟ookie琚鐢ㄧ殑鎯呭喌涓嬫墠浼氳皟鐢ㄥ埌銆
鎵浠ヨ锛宻ession鐨勮鍙栦篃鏄渶瑕乧ookie涓婇潰鐨凷essionID
瑕佷娇鐢╯ession棣栧厛瑕乻ession_start銆傜劧鍚庣洿鎺ユ搷浣$_SESSION灏卞彲浠ヤ簡
閿姣乻ession $_SESSION = [];鎴栬卻ession_destory();
session.auto_start 鏄惁鑷姩寮鍚痵ession_start
session.cookie_domian 瀛樺偍cookie鐨勬湁鏁堝煙
session.cookie_lifetime
session.cookie_path
session.name(榛樿鏄疨HPSESSID)
session.save_path(榛樿瀛樺偍璺緞)
session.use_cookies(鏄惁浣跨敤cookie鏉ヤ紶閫抯essionid)
session.use_trans_sid
session.gc_probability (鍨冨溇鍥炴敹鏈哄埗) =1 鏈変竴娆℃竻鐞嗙殑鏈轰細
session.gc_divisor = 100 姣忚闂竴鐧炬
session.gc_maxlifetime(鏈澶х敓鍛藉懆鏈) =1440 濡傛灉瓒呰繃25鍒嗛挓
seaaion.save_handler 鍙互鍌ㄥ瓨鍒皉edis,mysql绛 鍦ㄨ繖閲岄厤缃
浼樼偣瀹夊叏锛岄兘鏄瓨鍌ㄥ湪鏈嶅姟鍣ㄩ噷闈
缂虹偣 鍗犵敤鏈嶅姟鍣ㄧ鐩
鍋囪澶氬彴鏈嶅姟鍣,session鐨勫瓨鍌ㄥ氨浼氭槸涓涓棶棰橈紝濡傚湪涓鍙版湇鍔″櫒鐧婚檰鍚庝骇鐢熺殑session锛屽鏋滆璐熻浇鍧囪 杞鍒板彟澶栦竴鍙版湇鍔″櫒锛岄偅涔堣繖涓櫥闄嗗氨鏃犳晥浜嗭紝鎵浠ラ渶瑕佹妸session 瀛樺偍鍒板彟澶栫殑鍦版柟锛屽mysql锛宮emcache锛宺eids绛
鍙互浣跨敤session_set_save_handler()
鍙戣〃鍥炲