ÕªÒª£ºPHP²»Ö§³Ö¶àỊ̈߳¬ÓÐʱºò´¦ÀíÎÊÌâ²»ÊÇÄÇôˬ£¬½ñÌì̸ÂÛÒ»ÏÂPHP¶¨Ê±Ö´Ðеķ½·¨
PHP¶¨Ê±Ö´ÐеÄÈýÖÖ·½Ê½ÊµÏÖ
1¡¢windows µÄ¼Æ»®ÈÎÎñ
2¡¢linuxµÄ½Å±¾³ÌÐò
3¡¢ÈÃwebä¯ÀÀÆ÷¶¨Ê±Ë¢ÐÂ
¾ßÌåʵÏÖ
windows¼Æ»®ÈÎÎñ
PHPºÜÉÙÔÚwin·þÎñÆ÷ÉÏÅÜ£¬¾ßÌåʵÏÖÒ²²»ÔÙÉ£¬¿´ÍøÉÏʵÏÖµÄÔÀí´ó¸ÅÊÇдbat½Å±¾£¬È»ºóÈÃwindowÈÎÎñÌí¼ÓÖ´ÐÐÕâ¸öbat½Å±¾£¬¾ßÌå¿ÉÒԲο¼£ºhttp://www.cnblogs.com/whoknows/articles/2228577.html
linux µÄ½Å±¾ÊµÏÖ
ÕâÀïÖ÷ҪʹÓõ½crontabÕâ¸öÃüÁ
ʹÓ÷½Ê½ :
crontab filecrontab [ -u user ] [ -u user ] { -l | -r | -e }
˵Ã÷ :
crontab ÊÇÓÃÀ´ÈÃʹÓÃÕßÔڹ̶¨Ê±¼ä»ò¹Ì¶¨¼ä¸ôÖ´ÐгÌʽ֮ÓÃ
ʹÓÃcrontabдshell½Å±¾£¬È»ºóÈÃPHPµ÷ÓÃshell£¬Õâ¸öÊÇÀûÓÃlinuxµÄÌØÐÔ£¬Ó¦¸Ã»¹²»ËãPHP×ÔÉíÓïÑÔµÄÌØÐÔ
¿ÉÒԲο´£ºhttp://www.centos.bz/2011/07/php-cron-job-linux-crontab/
PHPʵÏÖ¶¨Ê±Ö´Ðмƻ®ÈÎÎñ
ʹÓÃphpÈÃä¯ÀÀÆ÷Ë¢ÐÂÐèÒª½â¾ö¼¸¸öÎÊÌâ
- PHP½Å±¾Ö´ÐÐʱ¼äÏÞÖÆ£¬Ä¬ÈϵÄÊÇ30m ½â¾ö°ì·¨£ºset_time_limit();»òÕßÐÞ¸ÄPHP.ini ÉèÖÃmax_execution_timeʱ¼ä£¨²»ÍƼö£©
- Èç¹û¿Í»§¶Ëä¯ÀÀÆ÷¹Ø±Õ£¬³ÌÐò¿ÉÄܾͱ»ÆÈÖÕÖ¹£¬½â¾ö°ì·¨£ºignore_user_abort¼´Ê¹¹Ø±ÕÒ³ÃæÒÀÈ»Õý³£Ö´ÐÐ
- Èç¹û³ÌÐòÒ»Ö±Ö´ÐкÜÓпÉÄÜ»áÏûºÄ´óÁ¿µÄ×ÊÔ´£¬½â¾ö°ì·¨Ê¹ÓÃsleepʹÓóÌÐòÐÝÃßÒ»»á£¬È»ºóÔÚÖ´ÐÐ
PHP¶¨Ê±Ö´ÐеĴúÂ룺
<?php ignore_user_abort();//¹Øµôä¯ÀÀÆ÷£¬PHP½Å±¾Ò²¿ÉÒÔ¼ÌÐøÖ´ÐÐ. set_time_limit(3000);// ͨ¹ýset_time_limit(0)¿ÉÒÔÈóÌÐòÎÞÏÞÖƵÄÖ´ÐÐÏÂÈ¥ $interval=5;// ÿ¸ô5sÔËÐÐ //·½·¨1--ËÀÑ»· do{ echo '²âÊÔ'.time().'<br/>'; sleep($interval);// µÈ´ý5s }while(true); //·½·¨2---sleep ¶¨Ê±Ö´ÐÐ require_once './curlClass.php';//ÒýÈëÎļþ $curl = new httpCurl();//ʵÀý»¯ $stime = $curl->getmicrotime(); for($i=0;$i<=10;$i++){ echo '²âÊÔ'.time().'<br/>'; sleep($interval);// µÈ´ý5s } ob_flush(); flush(); $etime = $curl->getmicrotime(); echo '<hr>'; echo round(($etime-stime),4);//³ÌÐòÖ´ÐÐʱ¼ä
×ܽ᣺
¸öÈ˸оõPHP¶¨Ê±Ö´ÐÐÈÎÎñµÄЧÂʲ»ÊǺܸߣ¬½¨Òé¹ØÓÚ¶¨Ê±Ö´ÐÐÈÎÎñµÄ¹¤×÷»¹Êǽ»¸øshellÀ´×ö°É£¬±È½ÏÄDzÅÊÇÍõµÀ¡£
ps£ºÄǸöËÀÑ»·µÄ·½·¨ºÃÏñÊǶñÒâ¹¥»÷ÍøÕ¾¾³£Ê¹Óõķ½·¨
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿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¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ