如何在PHP Web应用程序中运行后台任务? [重复]

如何在PHP Web应用程序中运行后台任务?  [重复]

问题描述:

This question already has an answer here:

I want to run a background scheduler in my web application. This scheduler will check the current time and if it matches with the programmed time then it sends a E-mail. How can i create background Scheduler ?

</div>

此问题已经存在 这里有一个答案: p>

  • PHP:运行预定作业(cron作业) 13 answers span> li> ul> div>

    我想在我的网络应用程序中运行后台调度程序。 此调度程序将检查当前时间以及是否与编程时间匹配,然后发送电子邮件。 如何创建后台调度程序? p> div>

It depends if you want to run a script in background via command line, than you can use exec command: exec

Or if you want to start another thread, than you can use pthreads

If you want to have a job that executes at a certain time or in certain intervals, you can set up a cronjob. This tutorial is very helpful, and if you are on linux you can look at this documentation.

You need to setup cron job. You may find more information a link!