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

How to automatically refresh the page in php

(*-*)浩
Release: 2023-02-24 12:24:02
Original
135066 people have browsed it

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>");
?>
Copy after login

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!

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