尊龙凯时人生就是搏

һЩ³£¼ûµÄLaravel׼ʱʹÃü²»ÔËÐеÄÎÊÌâ

Ëæ×ÅÏÖ´ú»¥ÁªÍø¼°Ó¦ÓóÌÐòµÄÒ»Ö±Éú³¤£¬Ðí¶à³ÌÐòÔ±×îÏÈʹÓÃlaravel×÷Ϊ×Ô¼ºµÄ¿ò¼Ü¡£laravel¿ò¼ÜÖÐÌṩµÄ׼ʱʹÃü¹¦Ð§£¬¿ÉÒÔͨ¹ý¼òÆÓµÄÉèÖÃÀ´×Ô¶¯Ö´ÐÐһЩʹÃü¡£¿ÉÊÇ£¬ÓÐʱ¼äÎÒÃǻᷢÃ÷ÕâЩ׼ʱʹÃü²¢Ã»ÓÐƾ֤ÎÒÃǵÄÔ¤ÆÚÀ´ÔËÐУ¬Õâʱ¼ä¸ÃÔõô°ìÄØ£¿

ÔÚ±¾ÆªÎÄÕÂÖУ¬ÎÒÃǽ«Ì½ÌÖһЩ³£¼ûµÄLaravel׼ʱʹÃü²»ÔËÐеÄÎÊÌ⣬²¢ÌṩÏìÓ¦µÄ½â¾ö¼Æ»®¡£

¼ì²é׼ʱʹÃüÉèÖÃ

Ê×ÏÈ£¬ÎÒÃÇÐèÒª¼ì²éÎÒÃǵÄ׼ʱʹÃüÊÇ·ñÒѾ­ÉèÖÃ׼ȷ¡£ÔÚLaravel¿ò¼ÜÖÐÉèÖÃ׼ʱʹÃüºÜÊǼòÆÓ£¬Ö»ÐèÔÚapp/Console/Kernel.phpÎļþÖнç˵һ¸öscheduleÒªÁì¼´¿É¡£scheduleÒªÁì°üÀ¨ÁËÎÒÃÇÒªÔËÐеÄËùÓÐʹÃü£¬ÈçÏÂËùʾ£º

protected function schedule(Schedule $schedule)
{
    $schedule->command('email:send')->daily();
    $schedule->command('email:send --force')->hourly();
}

µÇ¼ºó¸´ÖÆ

×¢ÖØ£¬´Ë´¦µÄÏÂÁîemail:send´ú±íÎÒÃÇÒªÔËÐеÄÏêϸʹÃü¡£ÈôÊÇÎÒÃǵÄ׼ʱʹÃüÉèÖÃ׼ȷ£¬¿ÉÊÇ׼ʱʹÃüÒÀÈ»ÎÞ·¨ÔËÐУ¬ÄÇôÎÒÃÇ¿ÉÒÔ˼Á¿¼ì²éÒÔϼ¸¸ö·½Ã棺

¼ì²éϵͳʱ¼ä

Laravel׼ʱʹÃüÊÇÒÀÀµÏµÍ³Ê±¼äµÄ£¬ÈôÊÇϵͳʱ¼ä²»×¼È·£¬ÄÇô׼ʱʹÃü¾Í¿ÉÄÜÎÞ·¨×¼Ê±ÔËÐС£Òò´Ë£¬ÎÒÃÇÐèÒª¼ì²éϵͳʱ¼äÊÇ·ñ׼ȷ¡£

ÈôÊÇÎÒÃÇʹÓÃLinux²Ù×÷ϵͳ£¬ÔÚÖÕ¶ËÊäÈëÒÔÏÂÏÂÁî¿ÉÒÔÉó²éÄ¿½ñµÄϵͳʱ¼ä£º

$ date

µÇ¼ºó¸´ÖÆ

ÈôÊÇÎÒÃÇʹÓÃWindows²Ù×÷ϵͳ£¬ÔÚÏÂÁîÌáÐÑ·ûÖÐÊäÈëÒÔÏÂÏÂÁî¿ÉÒÔÉó²éÄ¿½ñµÄϵͳʱ¼ä£º

> time/T
> date/T

µÇ¼ºó¸´ÖÆ

ÈôÊÇϵͳʱ¼ä²»×¼È·£¬ÎÒÃÇÐèÒªÊÖ¶¯ÉèÖÃ׼ȷʱ¼ä¡£

¼ì²é׼ʱʹÃüÔËÐÐÓû§È¨ÏÞ

Laravel׼ʱʹÃüĬÈÏÊÇÒÔÄ¿½ñÉÏ°¶Óû§µÄȨÏÞÀ´Ö´ÐеÄ¡£ÈôÊÇÄ¿½ñÉÏ°¶Óû§È¨ÏÞȱ·¦£¬×¼Ê±Ê¹Ãü¾Í¿ÉÄÜÎÞ·¨Õý³£ÔËÐС£Òò´Ë£¬ÎÒÃÇÐèÒª¼ì²é׼ʱʹÃüÔËÐеÄÓû§È¨ÏÞÊÇ·ñ×ã¹»¡£

¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éÄ¿½ñÓû§£º

$ whoami

µÇ¼ºó¸´ÖÆ

ÈôÊÇÄ¿½ñÓû§È¨ÏÞȱ·¦£¬ÎÒÃÇ¿ÉÒÔʵÑéʹÓÃsudoÏÂÁîÀ´ÔËÐÐLaravel׼ʱʹÃü£º

$ sudo php artisan schedule:run

µÇ¼ºó¸´ÖÆ

×¢ÖØ£¬ÎÒÃÇÐèÒª¾ßÓÐÖÎÀíԱȨÏ޲ŻªÊ¹ÓÃsudoÏÂÁî¡£

¼ì²éʹÃüÊÇ·ñ±»Ëø¶¨

Laravel׼ʱʹÃüµÄĬÈÏ»úÖÆÊÇÔÚÒ»¸öʹÃüÔËÐеÄʱ¼ä»áÏȸøÕâ¸öʹÃü¼ÓÉÏÒ»°ÑËø£¬±ÜÃâÖظ´ÔËÐС£ÈôÊÇÄ¿½ñʹÃü»¹Ã»ÓÐÔËÐÐÍê±Ï£¬ÄÇô¾ÍÎÞ·¨Æô¶¯ÐµÄʹÃü¡£Õâʱ¼äÎÒÃÇÐèÒª¼ì²éÒÔÏÂÁ½ÖÖÇéÐΣº

ʹÃüËø׼ʱ¼ä¹ý³¤£ºÈôÊÇÎÒÃǵÄʹÃüÔËÐÐʱ¼ä¹ý³¤£¬¾ÍÓпÉÄܵ¼ÖÂʹÃüËø׼ʱ¼ä¹ý³¤£¬Õâʱ¼äÎÒÃÇÐèÒªµ÷½âËø׼ʱ¼ä¡£

ʹÃüûÓÐÕý³£¿¢Ê£ºÈôÊÇÎÒÃǵÄʹÃüÒì³£ÖÕÖ¹£¬Ò²»áµ¼ÖÂʹÃüËø¶¨¡£´ËʱÎÒÃÇ¿ÉÒÔͨ¹ýÉó²éÈÕÖ¾ÎļþÀ´ÕÒµ½ÎÊÌâ²¢½â¾öËü¡£

¼ì²é׼ʱʹÃüÊÇ·ñÆôÓÃ

×îºó£¬ÎÒÃÇÐèÒª¼ì²é׼ʱʹÃüÊÇ·ñÆôÓá£ÓÐЩ׼ʱʹÃü¿ÉÄÜÊÇ¿ÉÒÔÊÖ¶¯¿ØÖÆÊÇ·ñ¿ªÆôµÄ£¬ÎÒÃÇÐèÒª¼ì²éÊÇ·ñÒѾ­ÆôÓá£

ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´Éó²éËùÓеÄ׼ʱʹÃü£º

$ crontab -l

µÇ¼ºó¸´ÖÆ

ÈôÊÇ׼ʱʹÃüûÓÐÔÚÁбíÖÐÏÔʾ£¬ÎÒÃÇÐèÒªÊÖ¶¯½«ÆäÌí¼Óµ½×¼Ê±Ê¹ÃüÁбíÖС£

×ܽá

ÔÚLaravel¿ò¼ÜÖУ¬Ê¹ÓÃ׼ʱʹÃü¿ÉÒÔÇáËÉʵÏÖ×Ô¶¯Ö´ÐÐһЩʹÃü¡£¿ÉÊÇ£¬ÔÚÏÖʵ¿ª·¢Àú³ÌÖУ¬ÎÒÃÇ¿ÉÄÜ»áÓöµ½×¼Ê±Ê¹Ãü²»ÔËÐеÄÎÊÌâ¡£±¾ÎÄÕë¶ÔÕâ¸öÎÊÌâÌṩÁËһЩ³£¼ûµÄ½â¾ö¼Æ»®£¬×ÊÖúÎÒÃǸüºÃµØʹÓÃLaravel¿ò¼ÜÖеÄ׼ʱʹÃü¡£

ÒÔÉϾÍÊÇһЩ³£¼ûµÄLaravel׼ʱʹÃü²»ÔËÐеÄÎÊÌâµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是搏ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是搏ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ