phpº¯ÊýÇ°ÃæµÄ&·ûºÅ
º¯ÊýµÄÒýÓ÷µ»Ø
ÏÈ¿´´úÂë ¸´ÖÆPHPÄÚÈݵ½¼ôÌù°å
PHP´úÂë:
function &test()
{
static $b=0;//ÉêÃ÷Ò»¸ö¾²Ì¬±äÁ¿
$b=$b+1;
echo $b;
return $b;
}
$a=test();//ÕâÌõÓï¾ä»áÊä³ö¡¡$bµÄÖµ¡¡Îª£±
$a=5;
$a=test();//ÕâÌõÓï¾ä»áÊä³ö¡¡$bµÄÖµ¡¡Îª2
$a=&test();//ÕâÌõÓï¾ä»áÊä³ö¡¡$bµÄÖµ¡¡Îª3
$a=5;
$a=test();//ÕâÌõÓï¾ä»áÊä³ö¡¡$bµÄÖµ¡¡Îª6
ÏÂÃæ½âÊÍÏ£º¡¡
ͨ¹ýÕâÖÖ·½Ê½$a=test();µÃµ½µÄÆäʵ²»ÊǺ¯ÊýµÄÒýÓ÷µ»Ø£¬Õâ¸úÆÕͨµÄº¯Êýµ÷ÓÃûÓÐÇø±ð.
ÖÁÓÚÔÒò£º¡¡ÕâÊÇPHPµÄ¹æ¶¨
£Ð£È£Ð¹æ¶¨Í¨¹ý$a=&test(); ·½Ê½µÃµ½µÄ²ÅÊǺ¯ÊýµÄÒýÓ÷µ»Ø.
ÖÁÓÚʲôÊÇÒýÓ÷µ»ØÄØ£¨£Ð£È£ÐÊÖ²áÉÏ˵£ºÒýÓ÷µ»ØÓÃÔÚµ±ÏëÓú¯ÊýÕÒµ½ÒýÓÃÓ¦¸Ã±»°ó¶¨ÔÚÄÄÒ»¸ö±äÁ¿ÉÏÃæʱ¡£)
Õâ¾ä¹·Æ¨»°¡¡º¦ÎÒ°ëÌìû¿´¶®.
ÓÃÉÏÃæµÄÀý×ÓÀ´½âÊ;ÍÊÇ
$a=test()·½Ê½µ÷Óú¯Êý£¬Ö»Êǽ«º¯ÊýµÄÖµ¸³¸ø$a¶øÒÑ£¬¡¡¶ø$a×öÈκθı䡡¶¼²»»áÓ°Ïìµ½º¯ÊýÖеÄ$b.
¶øͨ¹ý$a=&test()·½Ê½µ÷Óú¯ÊýÄØ, ËûµÄ×÷ÓÃÊǽ«return $bÖеġ¡$b±äÁ¿µÄÄÚ´æµØÖ·Óë$a±äÁ¿µÄÄÚ´æµØÖ·,
Ö¸ÏòÁËͬһ¸öµØ·½.
¼´²úÉúÁËÏ൱ÓÚÕâÑùµÄЧ¹û($a=&b;) ËùÒԸıä$aµÄÖµ,Ҳͬʱ¸Ä±äÁË$bµÄÖµ,ËùÒÔÔÚÖ´ÐÐÁË:
$a=&test();
$a=5;
ÒÔºó£¬$bµÄÖµ±äΪÁË5
Ïà¹ØÎĵµ£º
1¡¢AddcSlashes ×Ö·û´®¼ÓÈ뷴бÏß
Óï·¨£ºstring addcslashes(string str,string charlist);
2¡¢AddSlashes ×Ö·û´®¼ÓÈ뷴бÏß
Óï·¨£ºstring addslashes(string str);
ÔÚÌض¨µÄ×Ö·ûÇ°¼Ó·´Ð±Ïߣº'¡¢"¡¢\¡¢NULL
3¡¢bin2hex ½«¶þ½øλת³ÉÊ®Áù½øλ
Óï·¨£ºstring bin2hex(string str);
4¡¢Chop È¥³ýÁ¬Ðø¿Õ°×,ͬrtrim()
Óï· ......
- -! Õæ²»ÈÝÒ×°¡£¬ÅªÁËÒ»Ì죬ÖÕÓڸ㶨ÁË£¡
ÔÚubuntu9.04Ï°²×°£¬Ê×ÏÈҪ׼±¸µÄ¶«Î÷ºÜ¶à£¬´ó²¿·ÖÊÇÓÃÀ´Ö§³ÖphpµÄ¿â£¬·Ï»°²»¶à˵£¬Ð´Õâ¸öÒ²ÊÇΪÁ˱ãÓÚÎÒÒÔºó²é¿´Ó㬼ÇÒä²»ÐУ¬¿È¡£¡£ÓÐÐèÒªµÄÅóÓÑÒ²¿ÉÒÔÀ´È¥Óá£
ÔÚubuntuÉÏ°²×°£¬ÓÐÒ»¸öºÃ´¦¾ÍÊÇÓÐÐÂÁ¢µÃÕâ¸öÈí¼þ£¬Ê×ÏÈÏÈ°²×°mysql£¬ ......
Ìṩһ¸öphp¶àÏß³ÌÉÏÏÂÎÄÖа²È«Ð´ÎļþµÄʵÏÖ·½·¨¡£Õâ¸öʵÏÖûÓÐʹÓÃphp µÄfile lock»úÖÆ£¬Ê¹ÓõÄÊÇÁÙʱÎļþ»úÖÆ¡£¶àÏß³ÌÖеĸ÷¸öÏ̶߳¼ÊǶԸ÷×Ô£¨Ã¿¸öÏ̶߳ÀÕ¼Ò»¸ö£©µÄÁÙʱÎļþд£¬È»ºóÔÙͬ²½µ½ÔÎļþÖС£
<?php
/**
* @usage: used to offer safe file write operation in multiple threads context, arbitory file ......
Ïȸø´ó¼ÒÌùÒ»¸öʵÀý
test.php
<?php
//°üº¬seppageÀàÎļþ
require 'seppage.class.php';
//µ±Ç°Ò³Âë
$pagenow=2;
//Ò³Ãæ×ÜÊý
$pageall=10;
/*
*ÐèÒª·ÖÒ³µÄURLµØÖ·£¬¿ÉÒÔURLÖпÉÒÔ×ÔÓÉʹÓÃ?ºÅ»òÕß&ºÅ£¬³ÌÐò»á×Ô¶¯Ê¶±ð
*´Ë²ÎÊýºÍ$modurl²ÎÊýÉèÖÃÒ»Ïî¼´¿É£¬ÈôÁ½ÏÓУ¬Ôò°´$modurlΪ׼
*/
$url='http://l ......
<?php
$host = "www.abc.com"; //ÄãÒª·ÃÎʵÄÓòÃû
$target = "/test.asp"; //ÄãÒª·ÃÎʵÄÒ³ÃæµØÖ·
$referer = "http://www.abcdefg.com/abc.html"; //αÔìÀ´Â·Ò³Ãæ
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if (!$fp){
echo "$errstr($errno)<br />\n";
} ......