ÖØÒªµÄPHP³¬¼¶È«¾Ö±äÁ¿×ܽá
ÖØÒªµÄPHP³¬¼¶È«¾Ö±äÁ¿×ܽá
2008-07-14 16:53:03
¡¡±êÇ©£ºÈ«¾Ö±äÁ¿
¡¡¡¡¡¡[ÍÆË͵½¼¼ÊõȦ
]
PHPÓÐ9¸öÔ¤¶¨Òå±äÁ¿Êý×飬·Ö±ð×ܽáÈçÏ£º
1¡¢$_SERVER
$_SERVER³¬¼¶È«¾Ö±äÁ¿°üº¬ÓÉweb·þÎñÆ÷´´½¨µÄÐÅÏ¢£¬ËüÌṩÁË·þÎñÆ÷ºÍ¿Í»§ÅäÖü°µ±Ç°ÇëÇó»·¾³µÄÓйØÐÅÏ¢¡£¸ù¾Ý·þÎñÆ÷²»Í¬£¬$_SERVERÖеÄ
±äÁ¿ÖµºÍ±äÁ¿¸öÊý»áÓвî±ð£¬²»¹ýÒ»°ã¶¼¿ÉÒÔÕÒµ½CGI1.1¹æ·¶Öж¨ÒåµÄ±äÁ¿¡£ÆäÖаüÀ¨£º
$_SERVER[ 'HTTP_REFERER' ] ; Òýµ¼Óû§µ½´ïµ±Ç°Î»ÖõÄÒ³ÃæµÄURL £»
$_SERVER[ 'REMOTE_ADDR‘ ] ; ¿Í»§IPµØÖ· £»
$_SERVER[ ’REQUEST_URI‘ ] ; URLµÄ·¾¶²¿·Ö¡£Èç¹ûURLÊÇ [url]http://www.example.com/blog/apache/index.html[/url]
£¬ÄÇôURI¾ÍÊÇ/blog/apache/index.html ¡£
$_SERVER[ 'HTTP_USER_AGENT' ] ; ¿Í»§µÄÓû§´úÀí£¬Ò»°ã»áÌṩ²Ù×÷ϵͳºÍä¯ÀÀÆ÷µÄÓйØÐÅÏ¢¡£
2¡¢$_GET
$_GET³¬¼¶È«¾Ö±äÁ¿°üº¬Ê¹ÓÃGET·½·¨´«µÝµÄ²ÎÊýµÄÓйØÐÅÏ¢¡£Èç¹ûÇëÇóURLΪ[url]http://www.example.com/index.html?cat=apache&id=157[/url]
£¬
¾Í¿ÉÒÔʹÓÃ$_GET³¬¼¶È«¾Ö±äÁ¿·ÃÎÊÈçϱäÁ¿£º
$_GET[ 'cat' ] = "apache" ;
$_GET[ 'id' ] = "157" ;
ĬÈÏÇé¿öÏ£¬Òª·ÃÎÊͨGET·½·¨´«µÝµÄ±äÁ¿£¬$_GET³¬¼¶È«¾Ö±äÁ¿ÊÇΨһµÄ;¾¶¡£
3¡¢$_POST
$_POST³¬¼¶È«¾Ö±äÁ¿°üº¬ÓÃPOST·½·¨´«µÝµÄ²ÎÊýµÄÓйØÐÅÏ¢¡£
<form caction="subscribe.php" method = "post">
<p>
Email address : &
Ïà¹ØÎĵµ£º
PHPÖÐͨ³£Óм¸ÖÖ×Ô¶¨Ò庯ÊýµÄ·½·¨£¬ÏÂÃæ½éÉÜһϣ¬ÎÒÃÇʹÓõÄÊÇÕâÖÖ·½Ê½£º
<?php
function foo($arg)
{
return $arg
}
?>
µ±Ä³Ð©²ÎÊýΪ¿ÉÑ¡ÊÇ£¬¿ÉÒÔÕâÑù¶¨Ò壺
<?php
function foo($arg = NULL)
{
return $arg == NULL ? "" : $arg;
}
?>
µ±ÎÒÃDz»ÏÞÖƲÎÊý¸öÊýµÄʱºò£¬Ò²¿ÉÒ ......
¡¡¡¡PHP ÖУ¬Êý¾Ýͨ³£¶¼ÊÇ´æ´¢ÔÚMySQLÊý¾Ý¿âµ±Öеġ£µ«ÊÇÓÐЩʱºò£¬ÎÒÃÇ»¹ÊÇÐèҪʹÓÃPHP¶ÁдһЩ±¾µØÎļþ¡£±ÈÈçÉú³É¾²Ì¬Ò³Ãæ»òÕßÊý¾ÝµÄ±¾µØ»º´æ¡£
¡¡¡¡ÎÒÃÇÓÃÒ»¸ö¼òµ¥µÄ·ÃÎÊÈÕÖ¾À´ÑÝʾһÏÂfopen, fread, fwrite, fcloseµÄÓ÷¨¡£
¡¡¡¡Ã¿µ±ÎÒÃÇ·ÃÎÊ´ËÍøÒ³µÄʱºò£¬»áÏÔʾ³ö·ÃÎʹýµÄIPÒÔ¼°·ÃÎÊʱ¼ä£»Í¬Ê±µ±Ç°µÄ·ÃÎÊÒ²»á±»¼Ç ......
1. PEARµÄ°²×°, ÕâÀï½éÉÜÀûÓÃPHP5×Ô´øµÄBATÎļþ°²×°£¬ÐèÒªÄÜÉÏÍø¡£
a. ÔÚPHP5Ŀ¼ÏÂÕÒµ½go-pear.bat£¬Ë«»÷°²×°(±£Ö¤ÄÜÉÏÍø, ÒÔ±ãÏÂÔØ)£¬BAT×Ô¶¯´ÓÍøÉÏÏÂÔØPEARËùÐèµÄ¶«Î÷£»
b. °´ÕÕÌáʾÊäÈëһЩÉèÖÃÐÅÏ¢£¬Ö÷ÒªÊÇÒª°Ñ¾ÖÓòÍøµÄÍø¹Ø¼ÓÉÏ£¬Èçhttp://192.168.0.1:80/ , pearÒªÓÃÕâ¸öµØÖ··ÃÎÊInterne ......
PHP´´½¨Îļþ£¨¼Ð£©ÒÔ¼°Ä¿Â¼²Ù×÷
Ò»¡¢Ä¿Â¼²Ù×÷
Ê×ÏÈÊÇ´ÓĿ¼¶ÁÈ¡µÄº¯Êý,opendir(),readdir(),closedir(),ʹÓõÄʱºòÊÇÏÈ´ò¿ªÎļþ¾ä±ú,¶øºóµü´úÁгö:
<?php
$base_dir="filelist/";
$fso=opendir($base_dir);
echo $base_dir."<hr/>";
whil ......