PHPÖÐÅ׿ªcookieʹÓÃsession
ÔÚPHPÖÐʹÓùýSESSIONµÄÅóÓÑ¿ÉÄÜ»áÅöµ½Õâôһ¸öÎÊÌ⣬ÔÚijЩ¿Í»§¶ËµçÄÔÉÏ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ʹÓÃsession,Ö÷Ҫ;¾¶ÓÐÈýÌõ£º
1¡¢ÉèÖÃphp.iniÖеÄsession.use_trans_sid = 1»òÕß±àÒëʱ´ò¿ª´ò¿ªÁË--enable-trans-sidÑ¡ÏÈÃPHP×Ô¶¯¿çÒ³´«µÝsession id¡£(ps:Óа²È«Òþ»¼£¬×îºÃÓÃÎļþ¡¢Êý¾Ý¿â±£´æsession_id)
2¡¢ÊÖ¶¯Í¨¹ýURL´«Öµ¡¢Òþ²Ø±íµ¥´«µÝsession id¡£(ps:Óа²È«Òþ»¼£¬×îºÃÓÃÎļþ¡¢Êý¾Ý¿â
Ïà¹ØÎĵµ£º
PHP ÖеÄÑ»·Óï¾äÓÃÓÚÖ´ÐÐÏàͬµÄ´úÂë¿éÖ¸¶¨µÄ´ÎÊý¡£
Ñ»·
ÔÚÄú±àд´úÂëʱ£¬Äú¾³£ÐèÒªÈÃÏàͬµÄ´úÂë¿éÔËÐкܶà´Î¡£Äú¿ÉÒÔÔÚ´úÂëÖÐʹÓÃÑ»·Óï¾äÀ´Íê³ÉÕâ¸öÈÎÎñ¡£
ÔÚ PHP ÖУ¬ÎÒÃÇ¿ÉÒÔʹÓÃÏÂÁÐÑ»·Óï¾ä£º
while Ö»ÒªÖ¸¶¨µÄÌõ¼þ³ÉÁ¢£¬ÔòÑ»·Ö´ÐдúÂë¿é do...while Ê×ÏÈÖ´ÐÐÒ»´Î´úÂë¿é£¬È»ºóÔÚÖ¸¶¨µÄÌõ¼þ³ÉÁ¢Ê±Öظ´Õâ¸öÑ» ......
$_GET ±äÁ¿ÓÃÓÚÊÕ¼¯À´×Ô method="get" µÄ±íµ¥ÖеÄÖµ¡£
$_GET ±äÁ¿
$_GET ±äÁ¿ÊÇÒ»¸öÊý×飬ÄÚÈÝÊÇÓÉ HTTP GET ·½·¨·¢Ë͵ıäÁ¿Ãû³ÆºÍÖµ¡£
$_GET ±äÁ¿ÓÃÓÚÊÕ¼¯À´×Ô method="get" µÄ±íµ¥ÖеÄÖµ¡£´Ó´øÓÐ GET ·½·¨µÄ±íµ¥·¢Ë͵ÄÐÅÏ¢£¬¶ÔÈκÎÈ˶¼ÊǿɼûµÄ£¨»áÏÔʾÔÚä¯ÀÀÆ÷µÄµØÖ·À¸£©£¬²¢ÇÒ¶Ô·¢Ë͵ÄÐÅÏ¢Á¿Ò²ÓÐÏÞÖÆ£¨×î¶à 100 ¸ö ......
1.Ò³ÃæÖ®¼äÎÞ·¨´«µÝ±äÁ¿
get,post,sessionÔÚ×îеÄphp°æ±¾ÖÐ×Ô¶¯È«¾Ö±äÁ¿Êǹرյģ¬ËùÒÔÒª´ÓÉÏÒ»Ò³ÃæÈ¡µÃÌá½»¹ýÀ´µÃ±äÁ¿ÒªÊ¹ÓÃ$_GET['foo'],$_POST['foo'],$_SESSION['foo']À´µÃµ½¡£µ±È»Ò²¿ÉÒÔÐÞ¸Ä×Ô¶¯È«¾Ö±äÁ¿Îª¿ª(php.ini¸ÄΪregister_globals = On)£»¿¼Âǵ½¼æÈÝÐÔ£¬»¹ÊÇÇ¿ÆÈ×Ô¼ºÊìϤеÄд·¨±È½ÏºÃ¡£
2.Win32 ......
ÓÃPHPʵÏÖ½ø¶ÈÌõЧ¹û¡£
<?php
set_time_limit(0);
echo '<h2>ÕýÔÚ°²×°£¬ÇëÉÔºó...</h2>',
'<div style="border:1px solid #000;width:500px;"><div id="progress_bar">loading...</div></div>';
for($i=1;$i<=100;$i++){
$width = '500';
......
Linux + Apache2.0 + Mysql + PHP + phpBB3.0
1.°²°ü£º
Apache2.0
#tar -zxf httpd-***.tar.gz -C /usr/local/src/
#cd /usr/local/src/httpd-***
  ......