首页 >后端开发 >php教程 >TP_PHP及时显示执行数据

TP_PHP及时显示执行数据

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原创
2016-06-23 13:34:19984浏览

控制器方法

    public function autoDemo(){        $this->display();        for ($i=0; $i < 50; $i++) {             sleep(3);            show_msg($i.'*3秒过去了...','green');        }   }

输出函数

function show_msg($msg, $class = ''){    echo "<script type=\"text/javascript\">showmsg(\"{$msg}\", \"{$class}\")</script>";    flush();    ob_flush();}

模板

<!DOCTYPE html><html><head>	<meta charset="UTF-8">	<title>Document</title></head><body>    <div id="show-list" class="install-database">    </div>    <script type="text/javascript">        var list   = document.getElementById('show-list');        function showmsg(msg, classname){            var li = document.createElement('p');             li.innerHTML = msg;            classname && li.setAttribute('class', classname);            list.appendChild(li);            document.scrollTop += 30;        }    </script></body></html>


声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn