PHP-自动刷新页面 [英] PHP - auto refreshing page
本文介绍了PHP-自动刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用以下代码刷新页面,完成后不会重新加载.以下代码有时无法正常工作.
I am using following code for a refreshing page, it is not reloading on completion. The following code is not working sometime.
$page = $_SERVER['PHP_SELF'];
$sec = "10";
header("Refresh: $sec; url=$page");
echo "Watch the page reload itself in 10 second!";
推荐答案
使用<meta>
重定向而不是标头重定向,例如:
Use a <meta>
redirect instead of a header redirect, like so:
<?php
$page = $_SERVER['PHP_SELF'];
$sec = "10";
?>
<html>
<head>
<meta http-equiv="refresh" content="<?php echo $sec?>;URL='<?php echo $page?>'">
</head>
<body>
<?php
echo "Watch the page reload itself in 10 second!";
?>
</body>
</html>
这篇关于PHP-自动刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文