{"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

linux\u5b9a\u65f6\u6267\u884csh\u6587\u4ef6_linux\u5b9a\u65f6\u6267\u884cphp\u6587\u4ef6_linux\u5b9a\u65f6\u5668\u6267\u884c\u811a\u672c<\/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

\u8fd0\u7528`crontab-e`\u547d\u4ee4<\/a>\u8fdb\u884cCron\u4f5c\u4e1a\u914d\u7f6e\u7684\u8f93\u5165\u4e0e\u4fee\u6539\u3002<\/p>\n

\u9700\u786e\u4fdd\u6dfb\u52a0\u5165\u52a1\u5217\u8868\u7684\u4efb\u52a1\u5982`04***\/usr\/bin\/php\/path\/to\/your\/update_script.php`\u6b63\u786e\u65e0\u8bef\u3002<\/p>\n

4.\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u8ba9Cron\u52a0\u8f7d\u65b0\u4efb\u52a1\u3002<\/p>\n

\u6b64\u6848\u4f8b\u8868\u660e\uff0c\u8bbe\u7acb\u5b9a\u65f6\u4efb\u52a1\u5e76\u975e\u96be\u4ee5\u9a7e\u9a6d\uff0c\u5173\u952e\u5728\u4e8e\u719f\u7ec3\u628a\u63e1\u5176\u6b65\u9aa4\u4e0e\u6280\u5de7\u3002<\/p>\n

\u5b9a\u65f6\u4efb\u52a1\u7684\u76d1\u63a7\u4e0e\u7ba1\u7406<\/b><\/p>\n

\u914d\u7f6e\u5b9a\u65f6\u4efb\u52a1\u540e\uff0c\u9996\u8981\u5de5\u4f5c\u4fbf\u662f\u5bf9\u5176\u8fdb\u884c\u76d1\u89c6\u4e0e\u7ba1\u7406\uff0c\u5305\u62ec\u786e\u8ba4\u4efb\u52a1\u662f\u5426\u6309\u671f\u8fd0\u884c\u53ca\u5728\u4efb\u52a1\u51fa\u73b0\u5f02\u5e38\u65f6\u8fc5\u901f\u91c7\u53d6\u63aa\u65bd\u3002<\/p>\n

\u60a8\u53ef\u67e5\u9605Cron\u7684\u65e5\u5fd7\u6587\u4ef6\u4ee5\u4fbf\u76d1\u6d4b\u5176\u4efb\u52a1\u7684\u5b9e\u9645\u8fd0\u4f5c\u72b6\u6001\u3002\u540c\u65f6\uff0c\u501f\u52a9\u5982cPanel\u6216Plesk\u7b49\u63a7\u5236\u9762\u677f\u8fd9\u6837\u7684\u7b2c\u4e09\u65b9\u5de5\u5177\u5bf9Cron\u8fdb\u884c\u8be6\u7ec6\u7ba1\u7406\u4e5f\u662f\u53ef\u80fd\u7684\u9014\u5f84\u3002<\/p>\n

\u5b9a\u65f6\u4efb\u52a1\u7684\u5b89\u5168\u6027\u8003\u8651<\/b><\/p>\n

\u5728\u6267\u884c\u5b9a\u65f6\u4efb\u52a1\u914d\u7f6e\u8fc7\u7a0b\u4e2d\uff0c\u5b89\u5168\u6027\u663e\u5f97\u5c24\u4e3a\u91cd\u8981\u3002\u52a1\u5fc5\u4fdd\u8bc1PHP\u6e90\u4ee3\u7801\u7684\u5b89\u5168\u6027\uff0c\u907f\u514d\u88ab\u6076\u610f\u653b\u51fb\u8005\u5229\u7528\u3002\u540c\u65f6\uff0c\u5e94\u5bf9Cron\u4efb\u52a1\u8fdb\u884c\u9002\u5f53\u7684\u6743\u9650\u63a7\u5236\uff0c\u9632\u6b62\u672a\u83b7\u6388\u6743\u7684\u8bbf\u95ee\u884c\u4e3a\u3002<\/p>\n

\u901a\u8fc7\u8fd9\u4e9b\u5b89\u5168\u63aa\u65bd\uff0c\u4f60\u53ef\u4ee5\u4fdd\u62a4\u4f60\u7684\u7cfb\u7edf\u514d\u53d7\u6f5c\u5728\u7684\u5b89\u5168\u5a01\u80c1\u3002<\/p>\n

\u603b\u7ed3\u4e0e\u5c55\u671b<\/b><\/p>\n

\u7ecf\u8fc7\u4e0a\u8ff0\u8be6\u7ec6\u8bb2\u89e3\uff0c\u76f8\u4fe1\u60a8\u5df2\u5b8c\u5168\u7406\u89e3\u4e86\u5728Linux\u7cfb\u7edf\u4e2d\u5b9e\u73b0PHP\u6587\u4ef6\u5b9a\u65f6\u6267\u884c\u7684\u65b9\u6cd5\u3002\u6b64\u4e3e\u5c06\u4f7f\u60a8\u7684\u7f51\u7ad9\u8fd0\u884c\u66f4\u4e3a\u9ad8\u6548\u4e14\u667a\u80fd\u5316\uff0c\u540c\u65f6\u4e5f\u6709\u52a9\u4e8e\u63d0\u5347\u60a8\u7684\u6280\u672f\u6c34\u5e73\u3002<\/p>\n

\u5982\u4eca\uff0c\u8bf7\u95ee\u8bf8\u4f4d:\u662f\u5426\u66fe\u56e0\u4e0d\u5f53\u8bbe\u7f6e\u5b9a\u65f6\u4efb\u52a1\u800c\u906d\u9047\u56f0\u6270\uff1f\u8bf7\u4e8e\u8bc4\u8bba\u533a\u5206\u4eab\u60a8\u7684\u7ecf\u9a8c\u4e0e\u5bf9\u7b56\uff0c\u5171\u540c\u63d0\u5347\u6280\u672f\u6c34\u5e73\u3002<\/p>\n

\u5728\u6b64\uff0c\u6073\u8bf7\u70b9\u8d5e\u5e76\u5171\u4eab\u6b64\u6587\uff0c\u4ee5\u52a9\u76ca\u4e8e\u4ed6\u4eba\u3002\u613f\u6211\u4eec\u5171\u540c\u626c\u5e06\u4e8e\u79d1\u6280\u4e4b\u6d77\uff0c\u63a2\u7d22\u65e0\u9650\u53ef\u80fd\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"

\u4e3a\u4ec0\u4e48\u9700\u8981\u5b9a\u65f6\u6267\u884cPHP\u6587\u4ef6\uff1f\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\u3002cron\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\u60a8\u53ef\u67e5\u9605Cron\u7684\u65e5\u5fd7\u6587\u4ef6\u4ee5\u4fbf\u76d1\u6d4b\u5176\u4efb\u52a1\u7684\u5b9e\u9645\u8fd0\u4f5c\u72b6\u6001\u3002<\/p>\n","protected":false},"author":1,"featured_media":292783,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[988],"tags":[999],"class_list":["post-292782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tougao","tag-999"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/292782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=292782"}],"version-history":[{"count":0,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/292782\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/292783"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=292782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=292782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=292782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}