Home>Article>Backend Development> 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:
进度条 0{%a%}
Server code:
'; echo str_repeat(' ' ,2024); $url = '/t/test.php'; header("Location: " . $url.'&id='.$i); $read_url = realpath('.'.$url); $content = file_get_contents('D:/phpnow/htdocs11/design/t/test.php'); $rr = preg_replace('/{%(.*)%}/','{%'.$i.'%}',$content); file_put_contents('D:/phpnow/htdocs11/design/t/test.php',$rr); ob_flush(); flush(); sleep(1); } ?>
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!