Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

phpÉèÖÃsessionµÄÉú´æÖÜÆÚ

sessionÎļþ±£´æÔÚ·þÎñÆ÷£¬¶Ôÿ¸ösession¶¼»áËæ»úÉú³ÉÒ»¸öΨһµÄsessionIdÀ´½øÐбêʶ£¬Ò»°ãÈç¹ûûÓÐÉèÖÃsessionµÄÉú´æÖÜÆÚ£¬Ôòsession»á±£´æÔÚÄÚ´æÖУ¬¹Ø±Õä¯ÀÀÆ÷£¬¸Ãsessionid»á×Ô¶¯×¢Ïú£¬ÖØÐÂÇëÇóʱÔò×Ô¶¯ÖØзÖÅä¡£
Èç¹û¿Í»§¶ËûÓнûÓÃcookie£¬ÔòÔÚʹÓÃsessionʱ£¬cookie»á°èÑÝ´æ´¢sessionIdºÍsessionÉú´æÖÜÆڵĽÇÉ«¡£¡¡ÎÒÃÇÀ´ÊÖ¶¯ÉèÖà Session µÄÉú´æÆÚ£º
<?php
session_start();
// ±£´æÒ»Ìì
$lifeTime = 24 * 3600;
setcookie(session_name(), session_id(), time() + $lifeTime, "/");
?>
¡¡¡¡Æäʵ Session »¹ÌṩÁËÒ»¸öº¯Êý session_set_cookie_params(); À´ÉèÖà Session µÄÉú´æÆڵģ¬¸Ãº¯Êý±ØÐëÔÚ session_start() º¯Êýµ÷ÓÃ֮ǰµ÷Óãº
<?php
// ±£´æÒ»Ìì
$lifeTime = 24 * 3600;
session_set_cookie_params($lifeTime);
session_start();
$_SESSION["admin"] = true;
?>
¡¡¡¡Èç¹û¿Í»§¶ËʹÓà IE 6.0 £¬ session_set_cookie_params(); º¯ÊýÉèÖà Cookie »áÓÐЩÎÊÌ⣬ËùÒÔÎÒÃÇ»¹ÊÇÊÖ¶¯µ÷Óà setcookie º¯ÊýÀ´´´½¨ cookie¡£
¡¡¡¡¼ÙÉè¿Í»§¶Ë½ûÓà Cookie Ôõô°ì£¿Ã»°ì·¨£¬ËùÓÐÉú´æÖÜÆÚ¶¼ÊÇä¯ÀÀÆ÷½ø³ÌÁË£¬Ö»Òª¹Ø±Õä¯ÀÀÆ÷£¬ÔÙ´ÎÇëÇóÒ³ÃæÓÖµÃÖØÐÂ×¢²á Session¡£ÄÇôÔõô´«µÝ Session ID ÄØ£¿Í¨¹ý URL »òÕßͨ¹ýÒþ²Ø±íµ¥À´´«µÝ£¬PHP »á×Ô¶¯½« Session ID ·¢Ë͵½ URL ÉÏ£¬URL ÐÎÈ磺http://www.openphp.cn/index.php?PHPSESSID=bba5b2a240a77e5b44cfa01d49cf9669£¬ÆäÖÐ URL ÖеIJÎÊý PHPSESSID ¾ÍÊÇ Session IDÁË£¬ÎÒÃÇ¿ÉÒÔʹÓà $_GET À´»ñÈ¡¸ÃÖµ£¬´Ó¶øʵÏÖ Session ID Ò³Ãæ¼ä´«µÝ¡£
<?php
// ±£´æÒ»Ìì
$lifeTime = 24 * 3600;
// È¡µÃµ±Ç° Session Ãû£¬Ä¬ÈÏΪ PHPSESSID
$sessionName = session_name();
// È¡µÃ Session ID
$sessionID = $_GET[$sessionName];
// ʹÓà session_id() ÉèÖûñµÃµÄ Session ID
session_id($sessionID);
session_set_cookie_params($lifeTime);
session_start();
$_SESSION['admin'] = true;
?>
¡¡¡¡¶ÔÓÚÐéÄâÖ÷»úÀ´Ëµ£¬Èç¹ûËùÓÐÓû§µÄ Session ¶¼±£´æÔÚϵͳÁÙʱÎļþ¼ÐÀ½«¸øά»¤Ôì³ÉÀ§ÄÑ£¬¶øÇÒ½µµÍÁË°²È«ÐÔ£¬ÎÒÃÇ¿ÉÒÔÊÖ¶¯ÉèÖà Session ÎļþµÄ±£´æ·¾¶£¬session_save_path() ¾ÍÌṩÁËÕâÑùÒ»¸ö¹¦ÄÜ¡£ÎÒÃÇ¿ÉÒÔ½« Session ´æ·ÅĿ¼ָÏòÒ»¸ö²»ÄÜͨ¹ý Web ·½Ê½·ÃÎʵÄÎļþ¼Ð£¬µ±È»£¬¸ÃÎļþ¼Ð±ØÐë¾ß±¸¿É¶ÁдÊôÐÔ¡£
<?php
// ÉèÖÃÒ»¸ö´æ·ÅĿ¼
$save


Ïà¹ØÎĵµ£º

php±éÀúËùÓÐÎļþ¼°Îļþ¼ÐµÄ·½·¨

 1.·½·¨Ò»£º
<?
$dir="D:";
static $dir_list =0;
static $file_list =0;
function listfile($dir){
global $dir_list,$file_list;
$d = dir($dir);
while ( $entry = $d->read()) {
$tem_curnt=$dir."/".$entry;
if($entry=="." || $entry=="..") continue;
if ( is_dir( $tem_curnt)) {
......

ÀûÓÃmemcachedÔÚ¶ą̀·þÎñÆ÷Ö®¼ä¹²ÏíPHPµÄsessionÊý¾Ý

×î½üÎҵļ¸ÆªÎÄÕ¶¼ÊÇÊÇ×î½üÏîÄ¿µÄÒ»µãÐĵÃ^^
Õâ¸öÏîÄ¿Ò»¿ªÊ¼¾ÍÉè¼ÆµÄ“ºÜ´ó”£¬¿¼ÂÇÁ˺ฺܶÔؾùºâ·½ÃæµÄ¶«Î÷£¬±ÈÈç²ÉÓÃnginx½«phpµÄÇëÇó·Ö̯µ½Èô¸É¸öÔËÐÐphp fastcgiµÄ¶ÀÁ¢·þÎñÆ÷ÖС£ÕâÑùµÄÉè¼Æ³ýÁËÔÚÿ¸öphp fastcgi·þÎñÆ÷ÖÐÒª±£´æÒ»·Ý³ÌÐòµÄ¿½±´ÒÔÍ⣬»¹ÓÐÒ»¸öؽ´ý½â¾öµÄÎÊÌâ¡£ÓÉÓÚphp fastcgi½ø³Ì·Ö±ðÔËÐÐÔ ......

ʹÓÃnginxÅäÖöà¸öphp fastcgi¸ºÔؾùºâ

ÅäÖû¹ÊǷdz£¼òµ¥µÄ£¬³ä·ÖÌåÏÖÁËnginxµÄÇ¿´óÓëÅäÖõļòµ¥^^ÏÂÃæÊÇ´óÖµķþÎñÆ÷½á¹¹Í¼£º
Ó¦ÓõÄ×îÇ°¶ËÊÇһ̨nginx·þÎñÆ÷£¬ËùÓо²Ì¬µÄÄÚÈݶ¼ÓÉnginxÀ´´¦Àí£¬¶ø½«ËùÓÐphpµÄÇëÇ󶼷Ö̯µ½ÏÂÓεÄÈô¸Ę́ÔËÐÐphp fastcgiÊØ»¤½ø³ÌµÄ·þÎñÆ÷ÖУ¬ÕâÑù¿ÉÒÔÒÔÒ»ÖÖÁ®¼ÛµÄ·½°¸À´ÊµÏÖ¶Ôϵͳ¸ºÔصķÖ̯£¬À©Õ¹ÏµÍ³µÄ¸ºÔØÄÜÁ¦¡£
Èý̨php fastc ......

ÓÃPHPÈçºÎÅжÏÒ»¸öÎļþµÄ±àÂ룿

 ÕûÀí×Ô£ºhttp://bbs.phpchina.com/viewthread.php?tid=18006
Îļþa.txt£¬ÓÃPHPÈçºÎÅжÏËüµÄ±àÂëÊÇGBK»¹ÊÇUTF-8ÄØ£¿
1£¬ÖØÐÂÈÏʶһÏ´ËÎÊÌ⣬µ±Ê±°æÖ÷»Ø¸´µÄʱºòÎҾ;õµÃmbº¯ÊýÀïÒ»¶¨ÓÐÕâÑùµÄ¹¦ÄÜ£¬µ«½ñÈÕÑо¿ÁËmb¿â£¬²¢Ã»ÓÐÕâÑùµÄ¹¦ÄÜ¡£ÓÃmb_detect_encoding×ÜÊDz»×¼È·¡£
echo mb_detect_encoding(file_get_conten ......

PHP³ÌÐòÔ±×îÒ×·¸10ÖÖ´íÎó(ת)


PHPÊǸöΰ´óµÄweb¿ª·¢ÓïÑÔ£¬Áé»îµÄÓïÑÔ£¬µ«ÊÇ¿´µ½php³ÌÐòÔ±Öܶø¸´Ê¼µÄ·¸µÄһЩ´íÎó¡£ÎÒ×öÁËÏÂÃæÕâ¸öÁÐ±í£¬ÁгöÁËPHP³ÌÐòÔ±¾­³£·¸µÄ10ÖдíÎ󣬴ó¶àÊýºÍ°²È«Ïà¹Ø¡£¿´¿´Äã·¸Á˼¸ÖÖ
1.²»×ªÒâhtml entities
 
  Ò»¸ö»ù±¾µÄ³£Ê¶£ºËùÓв»¿ÉÐÅÈεÄÊäÈ루ÌرðÊÇÓû§´ÓformÖÐÌá½»µÄÊý¾Ý£© £¬Êä³ö֮ǰ¶¼Òª×ªÒâ¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ