setTimeout('window.location.reload()', 1);");. The page will automatically refresh when the browser is running"/> setTimeout('window.location.reload()', 1);");. The page will automatically refresh when the browser is running">

Home  >  Article  >  Backend Development  >  How to automatically refresh the page in php

How to automatically refresh the page in php

(*-*)浩
(*-*)浩Original
2019-09-19 10:50:47134784browse

How to automatically refresh the page in php

First, open the php editor and create a new php file, for example: index.php. (Recommended learning: PHP programming from entry to proficiency)

How to automatically refresh the page in php

In index.php, enter the code: echo (" <script>setTimeout('window.location.reload()', 1);</script>");.

How to automatically refresh the page in php

The browser runs the index.php page, and it is found that the page will automatically refresh.

How to automatically refresh the page in php

Code:

<?php 
//echo "系统当前时间戳为:";
echo "";
echo time();
echo "<br>";
//<!--JS 页面自动刷新 -->
echo ("<script type=\"text/javascript\">");
echo ("function fresh_page()"); 
echo ("{");
echo ("window.location.reload();");
echo ("}"); 
echo ("setTimeout(&#39;fresh_page()&#39;,1000);"); 
echo ("</script>");
?>

The above is the detailed content of How to automatically refresh the page in php. 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