donglu2008 2014-04-19 07:07
浏览 78
已采纳

PHP生成报告计划任务

I'm working on a application where user can schedule date and time, when some reports should be generated.

He/She sets a date and time and type of report.

I have a piece of code to generate report. Now how can this be scheduled to run at user specified time and date.

I know about linux cron but please keep in mind that user selects date/time and type of report and the script should run at that time. Obviously all of this is automated. And there are going to be thousands of users using this feature.

Is there any alternative ( to linux cron ) in PHP to accomplish this?? What is the best way to do this?

Thanks, Sash

  • 写回答

1条回答 默认 最新

  • douyihuaimao733955 2014-04-19 07:29
    关注

    There is two ways to do that :

    First : use cron script to run in every minute to check if there is report that needs to be generated. If you dont wont to run that script every minute, force user to choose time like this : 10:00 , 10:15, 10:30... and set 15 min interval.

    Second : generate script with infinite loop that is run via console like php <script_name.php> a it have to do same job as cron script in that loop. Bad solution from my opinion

    I will stick with cron job solution for numeros of reasons. ;) So at the end use cron for that.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题