Home >Backend Development >PHP Tutorial >Progress bar implemented by php code

Progress bar implemented by php code

怪我咯
怪我咯Original
2017-07-23 10:58:594465browse

The progress bar is when the computer is processing a task, it displays the speed of processing the task, the degree of completion, the size of the remaining unfinished tasks, and the possible processing time in the form of pictures in real time. It is usually displayed in a rectangular bar shape. This article mainly introduces the code that uses PHP code to achieve the progress bar effect

<html> 
<head> 
</head> 
<body> 
<table width="400" border="0" cellspacing="1" cellpadding="1"> 
<tr> 
<td bgcolor="000000"> 
<table width="400" border="0" cellspacing="0" cellpadding="1"> 
<tr> 
<td bgcolor="ffffff"> 
<img src="bar.gif" src="bar.gif" width="0" height="16" id="percent_img" name="percent_img" align="absmiddle"> 
</td> 
</tr> 
</table> 
</td> 
<td> 
<span id="percent_txt" name="percent_txt">0%</span> 
</td> 
</tr> 
</table> 
</body> 
</html> 
<?php 
flush(); 
for($i=0;$i<=100;$i++) //循环输出100次JavaScript代码 
{ 
$width = $i * 4; 
echo "<SCRIPT>"; 
echo "percent_img.width=$width;"; //控制图片宽度 
echo "percent_txt.innerHTML=&#39;$i%&#39;;"; //控制百分比显示 
echo "</SCRIPT>"; 
for($j=0;$j<1000000;$j++) 
{ 
//为了演示进度条的效果,这里执行了一个空循环 
} 
flush(); 
} 
?>

The above is the detailed content of Progress bar implemented by php code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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