每24小时运行一次php任务 [英] running a php task every 24 hours
问题描述
我有一些函数使用curl从几个网站中提取信息,并将它们插入我的数据库。我只是想知道什么是最好的方式去执行这个任务每24小时?
I have some functions that use curl to pull information off a couple of sites and insert them into my database. I was just wondering what is the best way to go about executing this task every 24 hours?
我现在跑了windows,但是一旦我可能会切换到linux生活(如果这产生影响)。我现在在symfomy框架内工作。
I am running off windows now, but will probably switch to linux once I am live (if that makes a difference). I am working inside symfomy framework now.
我听说cronjobs可以做到这一点...但看看这个网站似乎远程工作,我宁愿只是保持东西我可以在我的电脑上运行一个服务吗? )
I hear cronjobs can do this this...but looking at the site it seems to work remotely and I would rather just keep things in house...Can i just "run a service" on my computer? whatever that means ;) (have heard it used)
感谢任何帮助,
Andrew
thanks for any help, Andrew
推荐答案
这正是什么 Cron (linux)或< a href =http://www.iopus.com/guides/winscheduler.htm =nofollow noreferrer>预定任务(窗口)。
This is exactly what Cron (linux) or Scheduled Tasks (windows) are for.
您可以在应用程式伺服器上执行这些操作,将所有内容保留在一个地方。
You can run them on your application server to keep everything in one place.
一个在我的家庭服务器上运行的cron每天备份其MySQL数据库。此过程只涉及一个系统。
For example, I have a cron running on my home server to backup its MySQL databases every day. Only one system is involved in this process.
这篇关于每24小时运行一次php任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!