donglv6747
2013-06-10 22:30
浏览 24
已采纳

交互后运行php脚本x小时(cronjob)

In my php script, I want a function to be executed 2 hours after an user has registered, whether he is logged in or not. I know it has somehow to be done with cronjob, but I have never worked with it before and I don't know how to pack this all together.

How would I go about this? I have looked around for answers but I haven't found a solution. My first idea was to store timestamps in a database and collect them with a query. A cronjob would then have to be run every few minutes to keep things updated. Would that be the right way? I would also appreciate some useful links for getting into cronjobs easily. Thanks in advance!

图片转代码服务由CSDN问答提供 功能建议

在我的php脚本中,我希望在用户注册后2小时执行一项功能,无论他是否已登录 在或不。 我知道它已经以某种方式完成了 cronjob ,但我以前从未使用它,我不知道如何将它们打包在一起。

我该如何解决这个问题? 我四处寻找答案,但我还没有找到解决方案。 我的第一个想法是将时间戳存储在数据库中并使用查询收集它们。 然后必须每隔几分钟运行一次cronjob以保持更新。 这是正确的方法吗? 我也很欣赏一些有用的链接,可以轻松进入cronjobs。 提前致谢!

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题