如何使用 PHP 安排任务?

发布于 2024-10-04 16:51:56 字数 78 浏览 0 评论 0原文

如何开发一个像Wordpress用来安排帖子的计划任务系统?他们使用 Cron Job 吗?如果他们使用它,他们如何通过 PKP 脚本配置它?

How to develop a schedule task system like the one used by Wordpress to schedule post? Do they use Cron Job? If they use it, how they configure it through PKP script?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

北方。的韩爷 2024-10-11 16:51:56

据我所知,WordPress只是将发布日期设置为未来的某个时间。它实际上并不会导致未来发生事件,只是当有人查看该网站时看起来是这样。

如果您确实想在将来做某事,则需要一个 cron 作业,Web 服务器仅响应用户代理发出的请求。

As far as I know, WordPress just sets the publish date to some time in the future. It doesn't actually cause an event to happen in the future, it just looks that way when someone views the site.

You'd need a cron job if you actually wanted to do something in the future, web servers only respond to requests made by user agents.

傲影 2024-10-11 16:51:56

使用 cron 并在迭代中使用您的脚本运行 php_cli 解释器。

Use cron and in iterations get run php_cli interpreter with your script.

贱贱哒 2024-10-11 16:51:56

我使用 php cron 任务,它们如下所示

0 0 * * * * php -f /var/www/public_html/mycronphpfile.php

这意味着,每天午夜,运行命令行 php 并执行指定的文件。

I use php cron tasks, they look like the following

0 0 * * * * php -f /var/www/public_html/mycronphpfile.php

This means, at midnight, every day, run the command line php and execute the specified file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文