dsfsdf7852 2011-06-09 12:42 采纳率: 100%
浏览 77


I've been searching on the net for the answer, but couldn't find.

How could I show some loading messsage or gif while the long executing script is running. I tested a number of different way like javascript, because my script is trying to use PLINK.exe to tail a file, which take about 30s to return the value. because it's one line code, I can't use flush(), is there any other way I cam make this happen?

$runCommand  = "C:\wamp\www\TS\batch\plink.exe Sever -l User \"ssh User@Server 'tail -600 /serverlog/test.log'\" ";
//exec($runCommand, $results); 
echo $results;
  • 写回答

3条回答 默认 最新

  • douwu5009 2011-06-13 05:58

    I've tried the following code, which given me exactly what I want. the page is displaying a "loading.gif" while loading the php script, and hide it when the script is finished. This is using JQuery.

    //$tr_arname=$_REQUEST['arname'] -> is the variable i've got from previous PHP page.
    <body onload="loadingAjax('myDiv');">
    var arname="<?php $tr_arname=$_REQUEST['arname']; echo "$tr_arname"; ?>";
    function loadingAjax(div_id)
        $("#"+div_id).html('<center><img src="images/loading.gif"><br><br><font color="#006699" face="arial" size="4"><b>Loading arerror.log <br><?php echo "$tr_arname"; ?> <br>Please Wait ...</b></font></center>');
            type: "POST",
            url: "ThePHPScriptPage.php",
            data: "arname=" + arname,
            success: function(msg){
    <div id="myDiv"></div>
    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline
  • ¥15 如何实现从tello无人机上获取实时传输的视频流,然后将获取的视频通过yolov5进行检测
  • ¥15 WPF使用Canvas绘制矢量图问题
  • ¥15 用三极管设计一个单管共射放大电路
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'