doulang6013 2013-02-11 10:10
浏览 59

使用cron运行一个很长的PHP任务,没有AJAX

I need to parse large Excel tables into my database. I'm using PHPExcel. The files are too big to import them at once, and I have to deal with max execution time and memory restrictions.

So now the system works this way: operator uploads the files in browser, and then the import scripts runs many times, until the whole file is parsed. The PHP script imports only part of excel file, and returns a value. If there are still some unparsed rows - script runs again by AJAX.

Now I want to move this task to cron, but I don't know how, because I don't know how many times the script needs to be executed until the job is done.

Is there some way to execute script again and again until it is done, but without dealing with it in browser (by AJAX, reload, etc.)

  • 写回答

3条回答 默认 最新

  • dongyuyi5680 2013-02-11 10:37
    关注

    Make the script to run in the background. Use exec function. Refer the manual below

    http://php.net/manual/en/function.exec.php

    评论

报告相同问题?

悬赏问题

  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)