PHP¼¸¸öÓÐÓõŦÄÜ»òÕߺ¯Êý
1¡£ÈÎÒâ²ÎÊý·½Ê½µ÷Óú¯Êý¡¡¡¡
Äã¿ÉÄÜÒѾ֪µÀPHPÔÊÐíÄú¶¨ÒåÔÚº¯ÊýµÄ¿ÉÑ¡µÄ²ÎÊý¡£µ«ÊÇ,Ò²ÓÐÒ»ÖÖÔÊÐíÍêÈ«ÈÎÒâÊýÁ¿µÄº¯Êý²ÎÊý¡£¡¡¡¡
Ê×ÏÈ,ÕâÀïÊÇÒ»¸öÀý×ÓÊÇ¿ÉÑ¡µÄ×Ô±äÁ¿:
// function with 2 optional arguments function foo($arg1 = '', $arg2 = '') { echo "arg1: $arg1\n"; echo "arg2: $arg2\n"; } foo('hello','world'); /* prints: arg1: hello arg2: world */ foo(); /* prints: arg1: arg2: */ÏÖÔÚ,ÈÃÎÒÃÇ¿´¿´ÈçºÎ½¨Ô칦ÄܽÓÊÜÈκÎÊýÄ¿µÄ²ÎÊý¡£Õâ´ÎÎÒÃǽ«ÀûÓÃfunc_get_args():
function foo() { $args = func_get_args(); foreach ($args as $k => $v) { echo "arg".($k+1).": $v\n"; } } foo(); /* prints nothing */ foo('hello'); /* prints arg1: hello */ foo('hello', 'world', 'again'); /* prints arg1: hello arg2: world arg3: again */
2. ʹÓÃGlob()ÕÒµ½µÄÎļþ
Ðí¶àPHPº¯Ê½Ò»Ö±ºÍÓÉÃèÊöÐÔµÄÃû×Ö¡£È»¶ø¿ÉÄܺÜÄÑÖªµÀÒ»¸öº¯ÊýÃüÃûΪglob()²¢,³ý·ÇÄãÒѾÊìϤÄǸöÊõÓïÊǴӱ𴦰áÀ´µÄ¡£¡¡¡¡
ÈÏΪËüÏñÒ»¸ö¸üÓÐÄÜÁ¦°æ±¾µÄº¯ÊýµÄ¹¦ÄÜ¡£Ëü¿ÉÒÔÈÃÄãʹÓÃËÑË÷Îļþģʽ¡£
/ get all php files $files = glob('*.php'); print_r($files); /* output looks like: Array ( [0] => phptest.php [1] => pi.php [2] => post_output.php [3] => test.php ) */¶àÖÖÀàÐ͵ÄÎļþ,ÕâÑùµÄ:
// get all php files AND txt files $files = glob('*.{php,txt}', GLOB_BRACE); print_r($files); /* output looks like: Array ( [0] => phptest.php [1] => pi.php [2] => post_output.php [3] => test.php [4] => log.txt [5] => test.txt ) */×¢ÒâÎļþ¿ÉÒÔ·µ»Ø·¾¶,È¡¾öÓÚÄãµÄ²éѯ:
$files = glob('../images/a*.jpg'); print_r($files); /* output looks like: Array ( [0] => ../images/apple.jpg [1] => ../images/art.jpg ) */Èç¹ûÄãÏëµÃµ½realpath()ÿ¸öÎļþ,Äã¿ÉÒÔµ÷ÕûÓú¯ÊýµÄ×÷ÓÃÊÇ:
$files = glob('../images/a*.jpg'); // applies the function to each array element $files = array_map('realpath',$files); print_r($files); /* output looks like: Array ( [0] => C:\wamp\www\images\apple.jpg [1] => C:\wamp\www\images\art.jpg ) */
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ