开发者

Feedback that a slow php script is working?

Running a PHP script that is doing a huge mysql query plus some crun开发者_JAVA技巧ching on the results. Because of this the script takes a long time to execute and may appear to be not working to the user.

Is there a way to provide feedback to the user that the script is running? Perhaps way to print to the browser with each loop - indicating what record it's on... kind of a "live output buffer" or something?


Try using flush(). http://us3.php.net/flush

You could also have a main page, that uses Javascript/jQuery to request the work page. Then, Javascript could show a nice little loader box telling you the the page is still doing stuff!


Do the request in an iframe. That way the user sees a page while the results are still being loaded in the frame. Ajax would work as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜