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¼¼ÊõÈËÔ±ÍøÕ¾£¬×ܽáÁ˹úÍâµÄÊ®¸öÄ¿Ç°×îÁ÷ÐеÄPHP
MVC¿ò¼Ü¡£¾ßÌåÅÅÃû˳Ðòδ±Ø׼ȷ£¬»¹ÓÐЩ֪Ãû¿ò¼Ü£¬ÈçKohanaµÈҲûÓÐÌá¼°¡£²»¹ýÈÔ¿ÉÒÔ×öΪһƪ²»´íµÄ²Î¿¼¡£
ÒÔÏÂΪʮ¸öÄ¿Ç°×îÁ÷ÐеĻùÓÚMVCÉè¼ÆģʽµÄPHP¿ò¼Ü¡£
1. Yii
YiiÊÇÒ»¸ö»ùÓÚ×é¼þµÄ¸ßÐÔÄܵÄPHPµÄ¿ò¼Ü£¬ÓÃÓÚ¿ª·¢´ó¹æÄ£WebÓ¦Óá£Yii²ÉÓÃÑ ......
1 PHPÖе¥ÒýºÅÓëË«ÒýºÅµÄÇø±ð
¡¡¡¡ÔÚPHPÖУ¬Í¨³£Ò»¸ö×Ö·û´®±»¶¨ÒåÔÚÒ»¶ÔÒýºÅÖУ¬È磺
'I am a string in single quotes'
"I am a string in double quotes"
¡¡¡¡PHPÓï·¨·ÖÎöÆ÷ÊÇÓóɶԵÄÒýºÅÀ´ÅжÏÒ»¸ö×Ö·û´®µÄ¡£Òò´Ë£¬ËùÓÐ×Ö·û´®±ØÐëʹÓÃͬһÖÖµ¥»òÕßË«
ÒýºÅÀ´¶¨Ò忪ʼºÍ½áÊø¡£ÀýÈ磬ÏÂÃæµÄ×Ö´®¶¨ÒåÊ ......
<!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
header("Content-Type:image/png");
srand((double)microtime()*1000000);
$img_height=20;
$img_width=60;
$im=@imagecreate($img_width,$img_height) or die("²»Äܳõʼ»¯GDÎļþÁ÷");
$background_color=imagecolorallocate($im,255,255,255);
$text_color=imagecolorallocate($im,233,14,91);
......
PHP´´½¨Îļþ£¨¼Ð£©ÒÔ¼°Ä¿Â¼²Ù×÷
Ò»¡¢Ä¿Â¼²Ù×÷
Ê×ÏÈÊÇ´ÓĿ¼¶ÁÈ¡µÄº¯Êý,opendir(),readdir(),closedir(),ʹÓõÄʱºòÊÇÏÈ´ò¿ªÎļþ¾ä±ú,¶øºóµü´úÁгö:
<?php
$base_dir="filelist/";
$fso=opendir($base_dir);
echo $base_dir."<hr/>";
whil ......