{"id":292782,"date":"2024-08-24T21:18:45","date_gmt":"2024-08-24T13:18:45","guid":{"rendered":"https:\/\/lrxjmw.cn\/zlzdsyxpcxts.html"},"modified":"2024-08-24T21:18:45","modified_gmt":"2024-08-24T13:18:45","slug":"zlzdsyxpcxts","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/zlzdsyxpcxts.html","title":{"rendered":"\u5728 Linux \u4e2d\u5b9a\u65f6\u8fd0\u884c PHP \u7a0b\u5e8f\uff1a\u63d0\u5347\u7f51\u7ad9\u667a\u80fd\u5316\u4e0e\u6548\u7387\u7684\u5173\u952e\u6280\u672f"},"content":{"rendered":"
\u5c0a\u656c\u7684\u5404\u4f4d\uff0c\u4eca\u65e5\u5c06\u4e0e\u5927\u5bb6\u5171\u4eab\u4e00\u9879\u6781\u5177\u4e2a\u6027\u548c\u5b9e\u7528\u6027\u5e76\u5b58\u7684\u6280\u80fd\u2014\u2014\u5728Linux<\/a>\u64cd\u4f5c\u7cfb\u7edf<\/a>\u4e2d\u5b9a\u65f6\u8fd0\u884cPHP\u7a0b\u5e8f\u3002\u8fd9\u662f\u4e00\u9879\u8db3\u4ee5\u4ee4\u60a8\u5728\u6280\u672f\u754c\u98ce\u534e\u7edd\u4ee3\u7684\u9ad8\u7ea7\u6280\u672f\u3002<\/p>\n \u4e3a\u4ec0\u4e48\u9700\u8981\u5b9a\u65f6\u6267\u884cPHP\u6587\u4ef6\uff1f<\/b><\/p>\n \u9996\u5148\uff0c\u7eb5\u89c2PHP\u811a\u672c\u7684\u5b9a\u65f6\u8fd0\u884c\u9700\u6c42\uff0c\u6b64\u4e3e\u663e\u5f97\u5c24\u4e3a\u91cd\u8981\u3002\u8bd5\u60f3\uff0c\u5018\u82e5\u60a8\u7684\u7f51\u7ad9\u6bcf\u65e5\u5fc5\u987b\u5728\u51cc\u6668\u8fdb\u884c\u6570\u636e\u66f4\u65b0\uff0c\u6216\u9700\u6bcf\u5c0f\u65f6\u63a8\u9001\u4e00\u6b21\u7535\u5b50\u90ae\u4ef6\uff0c\u624b\u52a8\u64cd\u4f5c\u663e\u7136\u4e0d\u5207\u5b9e\u9645\u4e14\u8d39\u65f6\u8d39\u529b\u3002\u4e8e\u662f\uff0c\u6211\u4eec\u901a\u8fc7\u5229\u7528Linux\u7684\u5f3a\u5927\u529f\u80fd\uff0c\u501f\u52a9\u5176\u5b9e\u73b0\u8fd9\u4e00\u4efb\u52a1\u81ea\u52a8\u5316\u3002<\/p>\n \u901a\u8fc7\u81ea\u52a8\u8c03\u5ea6php\u6587\u4ef6\uff0c\u60a8\u5c06\u4f7f\u60a8\u7684\u7f51\u7ad9\u66f4\u5177\u667a\u80fd\u5316\u53ca\u6548\u7387\u6027\u3002\u8fd9\u5c06\u6709\u52a9\u4e8e\u65e0\u9700\u8017\u8d39\u989d\u5916\u4eba\u529b\u8d44\u6e90\u7684\u524d\u63d0\u4e0b\uff0c\u4fdd\u8bc1\u7f51\u7ad9\u5404\u9879\u4efb\u52a1\u51c6\u65f6\u5b8c\u6210\uff0c\u4ece\u800c\u63d0\u5347\u7528\u6237\u4f53\u9a8c\u5e76\u52a9\u529b\u4e8e\u5728\u5e02\u573a\u7ade\u4e89\u4e2d\u8131\u9896\u800c\u51fa\u3002<\/p>\n Linux\u4e2d\u7684\u5b9a\u65f6\u4efb\u52a1\u795e\u5668\u2014\u2014Cron<\/b><\/p>\n \u5728Linux\u5185\u6838\uff0cCron\u582a\u79f0\u8d85\u5f3a\u5b9e\u7528\u5de5\u5177\uff0c\u72b9\u5982\u5c3d\u804c\u5c3d\u8d23\u7684\u5b88\u65f6\u72c2\u9b54\uff0c\u786e\u4fdd\u6309\u60a8\u6240\u613f\u7cbe\u786e\u6267\u884cPHP\u6587\u4ef6\u4efb\u52a1\uff0c\u4e0d\u8bba\u65f6\u95f4\u3001\u9891\u6b21\u4ea6\u6216\u7279\u5b9a\u65e5\u7a0b\u7686\u5728\u638c\u63a7\u4e4b\u4e2d\u3002<\/p>\n cron\u670d\u52a1\u7684\u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u7f6e\u4e8e\/etc\/crontab\u4e2d\uff0c\u7528\u6237\u53ef\u901a\u8fc7\u5bf9\u5176\u8fdb\u884c\u7f16\u8f91\u4ee5\u8bbe\u5b9a\u5b9a\u65f6\u4efb\u52a1\u3002\u82e5\u60a8\u521d\u6d89\u6b64\u9886\u57df\uff0c\u5efa\u8bae\u4e0d\u5fc5\u7126\u8651\uff0c\u6211\u4eec\u5c06\u9010\u6b65\u6307\u5f15\u60a8\u5b8c\u6210\u76f8\u5173\u64cd\u4f5c\uff0c\u52a9\u60a8\u8f7b\u677e\u638c\u63e1\u8be5\u9879\u6280\u80fd\u3002<\/p>\n \u5982\u4f55\u7f16\u5199Cron\u4efb\u52a1\uff1f<\/b><\/p>\n Cron\u4efb\u52a1\u521b\u5efa\u5e76\u4e0d\u590d\u6742\uff0c\u5173\u952e\u5728\u4e8e\u719f\u6089\u5176\u8bed\u6cd5\u89c4\u5219\u3002\u57fa\u672c\u7684Cron\u4efb\u52a1\u7531\u4e94\u9897\u661f\u53ca\u76f8\u5e94\u6307\u4ee4\u6784\u6210\uff0c\u6bcf\u9897\u661f\u5bf9\u5e94\u7279\u5b9a\u65f6\u95f4\u5355\u4f4d\u3002\u4f8b\u5982\uff0c\u9996\u9897\u661f\u8868\u793a\u5206\u949f\uff0c\u6b21\u4e4b\u4e3a\u5c0f\u65f6\u7b49\u4f9d\u6b21\u7c7b\u63a8\u3002<\/p>\n \u8b6c\u5982\uff0c\u82e5\u9700\u6bcf\u65e5\u65e9\u4e0a3\u70b9\u6267\u884c\u7279\u5b9a\u7684PHP\u811a\u672c\uff0c\u53ef\u53c2\u8003\u4ee5\u4e0b\u683c\u5f0f\u4e66\u5199`03***\/usr\/bin\/php\/path\/to\/your\/script.php`\u3002\u5176\u4e2d\uff0c`03***`\u4ee3\u8868\u6bcf\u65e5\u51cc\u66683\u70b9\u6574\uff0c\u7d27\u968f\u5176\u540e\u7684\u4fbf\u662f\u6240\u9700\u6267\u884c\u7684PHP\u811a\u672c\u8def\u5f84\u3002<\/p>\n \u8bbe\u7f6eCron\u4efb\u52a1\u7684\u6b65\u9aa4<\/b><\/p>\n \u914d\u7f6eCron\u4efb\u52a1\u65b9\u6cd5\u6781\u4e3a\u7b80\u6613\uff0c\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a\u9996\u5148\u542f\u52a8\u7ec8\u7aef\u5e76\u8fd0\u884c`crontab-e`\u6307\u4ee4\u4ee5\u7f16\u8f91Cron\u4efb\u52a1\u6587\u4ef6\uff1b\u968f\u540e\uff0c\u6839\u636e\u4e0a\u8ff0\u63d0\u53ca\u7684\u8bed\u6cd5\u89c4\u5219linux\u5b9a\u65f6\u6267\u884cphp\u6587\u4ef6<\/strong>\uff0c\u6dfb\u52a0\u6240\u9700\u7684\u5b9a\u65f6\u4efb\u52a1\u5373\u53ef\u3002<\/p>\n <\/p>\n \u5728\u5b8c\u6210\u4fdd\u5b58\u4e0e\u9000\u51fa\u7f16\u8f91\u5668\u64cd\u4f5c\u4e4b\u540e\uff0cCron\u5c06\u4f1a\u81ea\u53d1\u542f\u52a8\u52a0\u8f7d\u60a8\u7684\u65b0\u4efb\u52a1\u6d41\u7a0b\u3002\u8fd9\u610f\u5473\u7740\u4ece\u73b0\u5728\u8d77\uff0c\u60a8\u6240\u8bbe\u5b9a\u7684PHP\u6587\u4ef6\u5c06\u4e25\u683c\u6309\u7167\u9884\u5b9a\u7684\u65f6\u95f4\u70b9\u8fdb\u884c\u8fd0\u884c\uff0c\u8fd9\u79cd\u5de7\u5999\u7684\u7f16\u7a0b\u65b9\u5f0f\u662f\u4e0d\u662f\u8ba9\u4eba\u611f\u5230\u60ca\u53f9\u4e0d\u5df2\u5462\uff1f<\/p>\n \u5e38\u89c1\u7684Cron\u4efb\u52a1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6cd5<\/b><\/p>\n \u4f7f\u7528Cron\u5e94\u7528\u65f6linux\u5b9a\u65f6\u6267\u884cphp\u6587\u4ef6<\/strong>\uff0c\u7528\u6237\u53ef\u80fd\u906d\u9047\u6267\u884c\u65f6\u95f4\u5f02\u5e38\u6216\u65e0\u9884\u671f\u6548\u679c\u7b49\u56f0\u60d1\u3002\u8fd9\u7c7b\u95ee\u9898\u5f80\u5f80\u6e90\u4e8e\u8def\u5f84\u914d\u7f6e\u4e0d\u5f53\u6216\u662fPHP\u73af\u5883\u8bbe\u7f6e\u9519\u8bef\u6240\u5f15\u53d1\u3002<\/p>\n \u5904\u7406\u6b64\u7c7b\u95ee\u9898\u65f6suse linux \u4e0b\u8f7d\uff0c\u9700\u9996\u5148\u786e\u8ba4PHP\u6587\u4ef6\u8def\u5f84\u65e0\u8bef\uff0c\u540c\u65f6\u68c0\u67e5PHP\u73af\u5883\u662f\u5426\u90e8\u7f72\u5b8c\u5584\uff0c\u751a\u81f3\u53ef\u67e5\u9605Cron\u65e5\u5fd7\u6587\u4ef6\u4ee5\u67e5\u627e\u95ee\u9898\u6839\u6e90\u3002\u53ea\u8981\u4fdd\u6301\u8010\u5fc3\u7ec6\u81f4\u7684\u6001\u5ea6\uff0c\u5b9a\u80fd\u5bfb\u5f97\u89e3\u51b3\u4e4b\u9053\u3002<\/p>\n \u9ad8\u7ea7Cron\u6280\u5de7\uff1a\u73af\u5883\u53d8\u91cf\u548c\u65e5\u5fd7\u8bb0\u5f55<\/b><\/p>\n \u82e5\u60a8\u5df2\u5145\u5206\u638c\u63e1Cron\u4efb\u52a1\u57fa\u672c\u8bbe\u5b9a\uff0c\u4e0d\u59a8\u66f4\u6df1\u5165\u5730\u63a2\u7d22\u4e00\u4e9b\u9ad8\u7ea7\u5e94\u7528\u3002\u8b6c\u5982\uff0c\u53ef\u5229\u7528\u73af\u5883\u53d8\u91cf\u529f\u80fdlinux\u6587\u4ef6\u7cfb\u7edf\uff0c\u63d0\u4f9b\u7279\u5b9a\u53d8\u91cf\u7ed9PHP\u811a\u672c\u4ee5\u4fbf\u5176\u8fd0\u884c\uff1b\u5e76\u4e14\uff0c\u60a8\u8fd8\u80fd\u7075\u6d3b\u4f7f\u7528\u65e5\u5fd7\u8bb0\u5f55\u914d\u7f6e\uff0c\u65b9\u4fbf\u8ffd\u8e2a\u4efb\u52a1\u6267\u884c\u60c5\u51b5\u4ee5\u53ca\u5feb\u901f\u5b9a\u4f4d\u6f5c\u5728\u95ee\u9898\u3002<\/p>\n \u8fd9\u4e9b\u9ad8\u9636\u6280\u672f\u8d4b\u4e88\u5b9a\u65f6\u4efb\u52a1\u66f4\u9ad8\u7a0b\u5ea6\u7684\u7075\u6d3b\u6027\u4e0e\u9ad8\u6548\u6027\u3002\u638c\u63e1\u5e76\u8fd0\u7528\u5b83\u4eec\uff0c\u4fbf\u53ef\u5728Linux\u73af\u5883\u4e0b\u4ece\u5bb9\u5e94\u5bf9\u5404\u7c7b\u7e41\u7410\u7684\u5b9a\u65f6\u4efb\u52a1\u3002<\/p>\n \u5b9e\u6218\u6f14\u7ec3\uff1a\u4e00\u4e2a\u5b8c\u6574\u7684\u5b9a\u65f6\u4efb\u52a1\u6848\u4f8b<\/b><\/p>\n \u4e3a\u52a9\u5404\u4f4d\u6df1\u523b\u4e86\u89e3\u5982\u4f55\u8bbe\u5b9a\u5b9a\u65f6\u4efb\u52a1\uff0c\u73b0\u63d0\u4f9b\u4e00\u5b9e\u4f8b\u6f14\u7ec3\u3002\u5047\u8bbe\u8d35\u7ad9\u6bcf\u65e5\u9700\u5728\u51cc\u6668\u56db\u65f6\u66f4\u65b0\u6570\u636e\u5e93\uff0c\u53ef\u4f9d\u5982\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n 1.\u7f16\u5199\u4e00\u4e2aPHP\u811a\u672c\uff0c\u7528\u4e8e\u66f4\u65b0\u6570\u636e\u5e93\u3002<\/p>\n