每 24 小时运行一次 php 任务 [英] running a php task every 24 hours

查看:34
本文介绍了每 24 小时运行一次 php 任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些函数使用 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)

感谢您的帮助,安德鲁

推荐答案

这正是 Cron (linux) 或计划任务 (windows) 的用途.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆