Home > Backend Development > PHP Tutorial > PHP implements the principle of progress bar

PHP implements the principle of progress bar

王林
Release: 2023-04-07 11:48:02
forward
3211 people have browsed it

PHP implements the principle of progress bar

The principle of PHP implementation of progress bar:

Template replacement, set a logo on the page, wheel your own page, without sending a request to the server , the server side obtains the progress, and then replaces the page identifier to achieve the progress bar effect.

Page code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Lang" content="en">
<meta name="author" content="">
<meta http-equiv="Reply-to" content="@.com">
<meta name="generator" content="PhpED 5.8">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="creation-date" content="01/01/2009">
<meta name="revisit-after" content="15 days">
<title>进度条</title>
<script type="jquery.min.js"></script>
<script type="text/javascript">
function test(){
    location.reload();
    setTimeOut(&#39;test()&#39;,1000)
}
</script>
</head>
 
<body οnlοad="test()">
  <div id="test">0</div>
  
  <div id="" style="width: 100;">{%a%}</div>
</body>
</html>
Copy after login

Server code:

<?php
 
 for($i = 0;$i < 6;$i++){
      echo $i.&#39;<br/>&#39;;
      echo str_repeat(&#39;      &#39; ,2024);
      $url = &#39;/t/test.php&#39;;
      header("Location: " . $url.&#39;&id=&#39;.$i);
      $read_url = realpath(&#39;.&#39;.$url);
      $content = file_get_contents(&#39;D:/phpnow/htdocs11/design/t/test.php&#39;);
     $rr = preg_replace(&#39;/{%(.*)%}/&#39;,&#39;{%&#39;.$i.&#39;%}&#39;,$content);
     file_put_contents(&#39;D:/phpnow/htdocs11/design/t/test.php&#39;,$rr);
      ob_flush();
      flush();
      sleep(1);
  }

?>
Copy after login

The above is the detailed content of PHP implements the principle of progress bar. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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