是否需要让您的元刷新线高于您的</head>线?就我而言,我不能,因为我必须解析一些变量来指示页面自动刷新的秒数。所有这些都发生在我的页面中间,我也把这个标签放在中间。我的成功率一直很好,但有时根本不会刷新。
是否有任何其他我可以使用的刷新代码可以保证 100% 的成功率?
我在这里使用的标签是:
<meta http-equiv="refresh" content="<?=$now['rsecs'];?>" url="&session<?=rand(1,999999999999)?>">
是否需要让您的元刷新线高于您的</head>线?就我而言,我不能,因为我必须解析一些变量来指示页面自动刷新的秒数。所有这些都发生在我的页面中间,我也把这个标签放在中间。我的成功率一直很好,但有时根本不会刷新。
是否有任何其他我可以使用的刷新代码可以保证 100% 的成功率?
我在这里使用的标签是:
<meta http-equiv="refresh" content="<?=$now['rsecs'];?>" url="&session<?=rand(1,999999999999)?>">
您的语法错误:
<meta http-equiv="refresh" content="<?php echo $now['rsecs'];?>;URL='&session=<?php echo rand(1,999999999999);?>'">
我不确定仅将 &session 添加到 url 路径是否会将您发送到正确的位置。也许包括完整的网址?
URL='http://www.your-site.com/page.html?othervars=othervals&session=<?php echo rand(1,999999999999);?>
看到这个网址: -
http://davidwalsh.name/automatically-refresh-page-javascript-meta-tags
http://www.techtricky.com/how-to-refresh-page-or-part-of-the-page-automatically/
尝试这个
JavaScript 方法
var timer = null;
function auto_reload()
{
window.location = 'http://domain.com/page.php';
}
<body onload="timer = setTimeout('auto_reload()',10000);">
或者
META标签方法
以下内容每 30 秒刷新一次页面。
<head>
<meta http-equiv="refresh" content="30" />
</head>
或者
<meta http-equiv="refresh" content="0;http://www.example.com" />
或者
<meta http-equiv="refresh" content="0;URL=http://www.example.com" />
或者
<meta http-equiv="refresh" content="30;URL=http://intranet/page.asp?x=123" />