PHPÖÐSession±äÁ¿²»ÄÜ´«Ë͵½ÏÂÒ»Ò³µÄ½â¾ö·½·¨
ÔÚPHPÖÐʹÓùýSESSIONµÄÅóÓÑ¿ÉÄÜ»áÅöµ½Õâôһ¸öÎÊÌ⣬SESSION±äÁ¿²»ÄÜ¿çÒ³´«µÝ¡£ÕâÁîÎÒ¿àÄÕÁ˺ÃЩÈÕ×Ó£¬×îÖÕͨ¹ý²é×ÊÁÏ˼¿¼²¢½â¾öÁËÕâ¸öÎÊÌâ¡£ÎÒÈÏΪ£¬³öÏÖÕâ¸öÎÊÌâµÄÔÒòÓÐÒÔϼ¸µã£º
1¡¢¿Í»§¶Ë½ûÓÃÁËcookie
2¡¢ä¯ÀÀÆ÷³öÏÖÎÊÌ⣬ÔÝʱÎÞ·¨´æÈ¡cookie
3¡¢php.iniÖеÄsession.use_trans_sid = 0»òÕß±àÒëʱûÓдò¿ª--enable-trans-sidÑ¡Ïî
Ϊʲô»áÕâÑùÄØ£¿ÏÂÃæÎÒ½âÊÍһϣº
Session´¢´æÓÚ·þÎñÆ÷¶Ë£¨Ä¬ÈÏÒÔÎļþ·½Ê½´æ´¢session£©£¬¸ù¾Ý¿Í»§¶ËÌṩµÄsession idÀ´µÃµ½Óû§µÄÎļþ£¬È¡µÃ±äÁ¿µÄÖµ£¬session id¿ÉÒÔʹÓÿͻ§¶ËµÄCookie»òÕßHttp1.1ÐÒéµÄQuery_String£¨¾ÍÊÇ·ÃÎʵÄURLµÄ“?”ºóÃæµÄ²¿·Ö£©À´´«Ë͸ø·þÎñÆ÷£¬È»ºó·þÎñÆ÷¶ÁÈ¡SessionµÄĿ¼……¡£Ò²¾ÍÊÇ˵£¬session idÊÇÈ¡µÃ´æ´¢ÔÚ·þÎñÉϵÄsession±äÁ¿µÄÉí·ÝÖ¤¡£µ±´úÂësession_start();ÔËÐеÄʱºò£¬¾ÍÔÚ·þÎñÆ÷ÉϲúÉúÁËÒ»¸ösessionÎļþ£¬ËæÖ®Ò²²úÉúÁËÓë֮Ψһ¶ÔÓ¦µÄÒ»¸ösession id£¬¶¨Òåsession±äÁ¿ÒÔÒ»¶¨ÐÎʽ´æ´¢ÔڸղŲúÉúµÄsessionÎļþÖС£Í¨¹ýsession id£¬¿ÉÒÔÈ¡³ö¶¨ÒåµÄ±äÁ¿¡£¿çÒ³ºó£¬ÎªÁËʹÓÃsession£¬Äã±ØÐëÓÖÖ´ÐÐsession_start();½«ÓÖ»á²úÉúÒ»¸ösessionÎļþ£¬ÓëÖ®¶ÔÓ¦²úÉúÏàÓ¦µÄsession id£¬ÓÃÕâ¸ösession idÊÇÈ¡²»³öÇ°ÃæÌáµ½µÄµÚÒ»¸ösessionÎļþÖеıäÁ¿µÄ£¬ÒòΪÕâ¸ösession id²»ÊÇ´ò¿ªËüµÄ“Ô¿³×”¡£Èç¹ûÔÚsession_start();֮ǰ¼Ó´úÂësession_id($session id);½«²»²úÉúеÄsessionÎļþ£¬Ö±½Ó¶ÁÈ¡ÓëÕâ¸öid¶ÔÓ¦µÄsessionÎļþ¡£
PHPÖеÄsessionÔÚĬÈÏÇé¿öÏÂÊÇʹÓÿͻ§¶ËµÄCookieÀ´±£´æsession idµÄ,ËùÒÔµ±¿Í»§¶ËµÄcookie³öÏÖÎÊÌâµÄʱºò¾Í»áÓ°ÏìsessionÁË¡£±ØÐë×¢ÒâµÄÊÇ£ºsession²»Ò»¶¨±ØÐëÒÀÀµcookie£¬ÕâÒ²ÊÇsessionÏà±ÈcookieµÄ¸ßÃ÷Ö®´¦¡£µ±¿Í»§¶ËµÄCookie±»½ûÓûò³öÏÖÎÊÌâʱ£¬PHP»á×Ô¶¯°Ñsession id¸½×ÅÔÚURLÖÐ,ÕâÑùÔÙͨ¹ýsession id¾ÍÄÜ¿çҳʹÓÃsession±äÁ¿ÁË¡£µ«ÕâÖÖ¸½×ÅÒ²ÊÇÓÐÒ»¶¨Ìõ¼þµÄ£¬¼´“php.iniÖеÄsession.use_trans_sid = 1»òÕß±àÒëʱ´ò¿ª´ò¿ªÁË--enable-trans-sidÑ¡Ï£
ÓùýÂÛ̳µÄÅóÓѶ¼ÖªµÀ£¬ÔÚ½øÈëÂÛ̳µÄʱºò£¬ÍùÍù»áÌáʾÄã¼ì²éCookieÊÇ·ñ´ò¿ª£¬ÕâÊÇÒòΪ´ó¶àÊýÂÛ̳¶¼ÊÇ»ùÓÚCookieµÄ£¬ÂÛ̳ÓÃËüÀ´±£´æÓû§Ãû¡¢ÃÜÂëµÈÓû§ÐÅÏ¢£¬·½±ãʹÓ᣶øÇҺܶàÅóÓѶ¼ÈÏΪCookie²»°²È«£¨Æäʵ²»ÊÇÕâÑù£©£¬ÍùÍù½ûÓÃËü¡£ÆäʵÔÚPHP³ÌÐòÖУ¬ÎÒÃÇÍêÈ«¿ÉÒÔÓÃSESSIONÀ´´úÌæCookie£¬Ëü¿ÉÒÔ²»ÒÀÀµÓÚ¿Í»§¶ËÊÇ·ñ¿ªÆôCookie¡£
ËùÒÔ£¬ÎÒÃÇ¿ÉÒÔÅ׿ªcookie
Ïà¹ØÎĵµ£º
ÈçºÎ´´½¨ÎÒÃǵĵÚÒ»¸öPHPÒ³ÃæÄØ£¿·Ç³£¼òµ¥µÄ£¡Ñ¡ÔñÎÒÃÇʹÓõÄÒ»¸ö×îºÃµÄÉè¼Æ¹¤¾ß£¬µ±È»ÄãÒ²¿ÉÒÔ Ö»Ê¹ÓüÇʱ¾¡£´´½¨Ö®ºó¼ÇµÃÒª±£´æΪÀ©Õ¹ÃûΪPHPµÄÎļþ£¬È»ºó´«µ½ÎÒÃǵķþÎñÆ÷
ÉÏ¡£
¡¡¡¡ÔÚ±àдPHP³ÌÐò֮ǰͨ³£ÎÒÃÇÐèÒªÅäÖÃÎÒÃǵĻ·¾³£¬Ò²¾ÍÊÇ˵·þÎñÆ÷
ÒªÖ§³ÖPHP²ÅÄÜÐа¡
¡¡¡¡Ò»¡¢PHPµÄ»ù±¾½á¹¹£º
¡¡¡¡Ê¹ÓÃIncl ......
PHPÊÓƵ½Ì³ÌÏÂÔØ£¨PHP100ϵÁÐÊÓƵ½Ì³Ì£©
PHP100ÊÇÒ»¸öÕë¶ÔPHP³õѧÕßµÄPHPÊÓƵ½ÌѧÍøÕ¾£¬ÓÐÂù¸ßµÄÈËÆøºÍ»îÁ¦¡£Ä¿Ç°ÍøÉϵÄPHPµÄÊÓƵ×ÊÔ´²¢²»¶à£¬¶àÊý¶¼ÊÇÔÚÓÅ¿áµÈÊÓƵÍøÕ¾ÉϵĽ̳̣¬ÊÓƵ²»ÇåÎú£¬¶øÇÒÒ²²»È«ÃæºÍϵͳ¡£¶øPHP100ÍøÕ¾ÉϵÄϵÁÐÊÓƵ½Ì³Ì£¬ÅäÓпμþ£¬´ÓÈëÃŵ½¾«Í¨£¬ºÜ²»´í£¬»ù±¾±£³ÖÒ»ÖÜÒ»ÆڵĸüÐÂËٶȡ£share it£ ......
1¡¢Ä£°åµÄÓÉÀ´
ÔÚûÓÐÄ£°å¼¼Êõ֮ǰ£¬Ê¹ÓÃPHP¿ª·¢³ÌÐò£¬Í¨³£¶¼ÊÇphp´úÂëºÍhtml»ì±àÔÚÒ»Æð¡£±ÈÈç˵ÐÂÎÅÁÐ±í£¬ºÜ¿ÉÄܾÍÊÇÒ»¸önewslist.phpÒ³Ã棬½á¹¹ÈçÏ£º
<?
//´ÓÊý¾Ý¿âÖжÁÈ¡³öÒªÏÔʾµÄÐÂÎżÇ¼
?>
<html>
<head>……..
</head>
<body>
<?
While ($news ......
php google baidu ·ÖÒ³
<?php
/**
×÷Õߣº
äìÏ沩¿Í http://blog.csdn.net/fkedwgwy
ʱ¼ä£º
2009-11-26
php¼¼ÊõȺ£º
37304662
ʹÓ÷½·¨£º
include_once'Pager.class.php';
$pager=new Pager();
if(isset($_GET['page']))
$pager->setCurrentPage($_GET['page']);
else
$pager->setCurrentPage(1);
......
²É¼¯ÒѾ²»ÊÇʲôÐÂÃû´ÊÁË,ºÜ¶àÕ¾³¤ÎªÁËÊ¡ÊÂ,Ò²¾ÖÏÞÓÚÈËÁ¦µÄȱ·¦,ʹÓóÌÐòÀ´¸ø×Ô¼º
µÄÍøÕ¾Ìíש¼ÓÍß,±ÈÈç±¾È˵ĸöÈËÍøÕ¾Î÷Î÷¸¥Ë¹ÍøÒ²²É¼¯ÁË´óÁ¿µÄÐÂÎÅ,ÄÇôÈç¹ûʵÏÖÄØ?½ñÌìÎÒÃÇÔËÓÃphpÀ´ÊµÏÖÕâ¸ö¹¦ÄÜ.
̸µ½²É¼¯,ÎÒÃDz»µÃ²»ËµÁ½¸ö¶«Î÷,µÚÒ»¸öÊÇÈçºÎ»ñÈ¡Ô¶³ÌÍøÕ¾µÄÔ´´úÂë,Õâ¸ö¿ÉÒÔͨ¹ýphpµÄÒ»¸öÀ© ......