drnx3715 2010-11-25 12:43
浏览 52
已采纳

php:处理数组时输出状态栏(ajax / jQuery?)

I need a progress bar for a php script. As for now I choose a file in a html webformular and fire the form. Then nothing happens while the date is beeing processed for lets say 15 minuttes. First the file is turned into an array, then the array is inserted into a database.

I really would like to somehow show the progress.

  • Either just write a line to the screen for every row (tried flush and ob_flush without luck).
  • Then how about an ajax progress bar? Found a few but I cannot see how they can be implemented into a php-page processing a script.

If no other solution is available then it is possible to make a progress bar based on records in the database beeing updated - I added a marker for this so any sql count(*) will result in some answer.

BR. Anders

  • 写回答

1条回答 默认 最新

  • dsfdsf23423 2010-11-29 01:24
    关注

    As far as an AJAX progress bar, you could set an interval that polls a PHP file every so often.

    var timer = setInterval(“ajaxFunction();”, 5000); // call AJAX function every 5 seconds
    

    In your ajaxFunction() you can increment your progress bar based on the AJAX result (that result being whatever progress you're trying to determine)

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

报告相同问题?

悬赏问题

  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化