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

PHP»ñȡʱ¼ä²îº¯Êý

//¼ÆËã¾à¹«Ôª1Äê1ÔÂ1ÈÕµÄÌìÊý£¬$yyyyÄê·Ö£¬$mmÔ·ݣ¬$ddÈÕ
function datelocal($yyyy,$mm,$dd){
$monthdays = array(31,28,31,30,31,30,31,31,30,31,30,31); //·ÇÈòÄêµÄÔ·ÝÌìÊý
//ÅжÏÊÇ·ñΪÈòÄ꣬ÈòÄê$leapyear = 1£¬·ñÔò $leapyear = 0
if($yy%4==0 && $yyyy%100!=0 || $yyyy%400==0)
$leapyear = 1;
else
$leapyear = 0;
//¼ÆËã¾à¹«Ôª1Äê1ÔÂ1ÈÕµÄÌìÊý: ÄêÌìÊý+ÔÂÌìÊý+ÈÕÌìÊý
$days = ($yyyy-1)*365 + floor(($yyyy-1)/4) - floor(($yyyy-1)/100) + floor(($yyyy-1)/400);
for($i=1;$i<=$mm;$i++){
$days += $monthdays[$i-2];
if($leapyear==1 && $i==3) //ËùÔÚÄê·ÝΪÈòÄ꣬ÇÒÔ·ݳ¬¹ý2Ô£º28Ìì+1Ìì
$days += 1;
}
$days += $dd -1;
return $days;
}
//¼ÆËã $yyyy2-$mm2-$dd2, $yyyy1-$mm1-$dd1 Ïà²îÌìÊý
function datediff($yyyy2,$mm2,$dd2,$yyyy1,$mm1,$dd1){
$daysdiff = abs(datelocal($yyyy2,$mm2,$dd2) - datelocal($yyyy1,$mm1,$dd1));
return $daysdiff;
}
echo datediff(2008,5,10,2009,5,1);

ת×Ô£ºhttp://www.drulanz.com/website-build/lamp/phpdaysdiff/


Ïà¹ØÎĵµ£º

PHP ¶ÁÈ¡µØÖ·À¸ ²ÎÊý


1.  $_GET
£º
http://localhost/a.php?a=ok  
   
  <?  
  echo  
$_GET['a'];   //ÏÔʾ"ok"  
  ?>
2.  $_SERVER['QUERY_STRING']
http://localhost/a.php?a=1&b=2&c=3  
   
  ......

PHP ÖÐ global ±äÁ¿Ó÷¨

¡¡¡¡PHPÖеıäÁ¿Ò²ÓзÃÎÊÓò¡£×÷ÓÃÓò¿ÉÒÔʹÓÃPHPÖÐglobal
¡¡¡¡ÔÚº¯ÊýÄÚ²¿¡¢¶ÔÏóÖкÍÀàÖж¨ÒåµÄ¾Ö²¿±äÁ¿ÔÚº¯ÊýÍⲿÊÇÎÞ·¨±»·ÃÎʵ½µÄ£»Í¬Àí£¬ÔÚº¯ÊýÍⲿ¡¢¶ÔÏóÍâºÍÀàÍⶨÒåµÄ±äÁ¿£¬Èç¹ûûÓб»´«È룬ҲÊÇÎÞ·¨±»·ÃÎʵ½µÄ¡£
¡¡¡¡µ«ÊÇÈç¹ûÒ»¸öºÜ¶à±äÁ¿ÒªÍ¬Ê±±»´«ÈëºÜ¶àº¯Êý¡¢¶ÔÏó»òÕßÀ࣬ÎÒÃÇÒ²¿ÉÒÔÖ±½Ó½«ÆäÈ«¾Ö»¯¡£ÕâÑù²»½ö¿ÉÒÔ ......

PHP ÖÐ×Ô¶¨Ò庯ÊýµÄ¼¸ÖÖ·½Ê½


PHPÖÐͨ³£Óм¸ÖÖ×Ô¶¨Ò庯ÊýµÄ·½·¨£¬ÏÂÃæ½éÉÜһϣ¬ÎÒÃÇʹÓõÄÊÇÕâÖÖ·½Ê½£º
<?php
function foo($arg)
{
return $arg
}
?>
µ±Ä³Ð©²ÎÊýΪ¿ÉÑ¡ÊÇ£¬¿ÉÒÔÕâÑù¶¨Ò壺
<?php
function foo($arg = NULL)
{
return $arg == NULL ? "" : $arg;
}
?>
µ±ÎÒÃDz»ÏÞÖÆ²ÎÊý¸öÊýµÄʱºò£¬Ò²¿ÉÒ ......

php±í¸ñ(test)

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <style type = "text/css">
        &nbs ......

ÖØÒªµÄPHP³¬¼¶È«¾Ö±äÁ¿×ܽá




ÖØÒªµÄPHP³¬¼¶È«¾Ö±äÁ¿×ܽá

2008-07-14 16:53:03
¡¡±êÇ©£ºÈ«¾Ö±äÁ¿
¡¡¡¡¡¡[ÍÆË͵½¼¼ÊõȦ
]
        PHPÓÐ9¸öÔ¤¶¨Òå±äÁ¿Êý×飬·Ö±ð×ܽáÈçÏ£º
 
1¡¢$_SERVER
       
$_SERVER³¬¼¶È«¾Ö±äÁ¿°üº¬ÓÉweb·þÎñÆ÷´´½¨µÄÐÅÏ¢ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ