Home > Backend Development > PHP Tutorial > PHP执行实时进度

PHP执行实时进度

WBOY
Release: 2016-06-23 14:06:31
Original
2199 people have browsed it

写了一段代码

<?phpmysql_select_db("backup", $con);$file="edit.txt";        $txt=file($file);$length=count($txt);echo "文件 <b>$file</b> 一共有 <b>$length</b> 个数据";for($i=0;$i<$length;$i++){$RecordArr = explode("|",$txt[$i]);$name=$RecordArr[0];		$April=$RecordArr[1];$sql="UPDATE yuangong SET  April = '$April' WHERE name = '$name'";?>
Copy after login

其中“edit.exe”里有上万个数据。
我想在这里加入一个执行进度,哪位大虾能给我 发段代码,要实时的。最好是PHP的代码。简单点的要个百分比的就行了。


回复讨论(解决方案)

https://github.com/guiguiboy/PHP-CLI-Progress-Bar
http://pear.php.net/package/Console_Progressbar

或者搜索 "php cli progressbar" 能找到一大堆

for($i=0;$i echo '正在处理第'.$i.'条数据!进度:'.$i/$length*100.'%';

for($i=0;$i echo '正在处理第'.$i.'条数据!进度:'.$i/$length*100.'%'; !!
这个进度不动的啊。。只是一个数据显示一个进度,我这里几万个数据,它就显示了几万个进度!!

进度是一定要在输出端不断刷新的,你要明白这点

能实现不刷新显示一条进度条百分比吗?

继续求答案。。。

js 定时 ajax....好了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template