使用"标题刷新" (PHP)+"元刷新" (HTML)在一起

时间:2014-08-22 08:52:23

标签: php header refresh meta

我需要使用"标题刷新" (PHP)+"元刷新" (HTML)在一起,PHP刷新工作正常,但是meta one被忽略了,请帮帮我,谢谢

<? $idne2=$_GET['idne']; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Chat With <?="$idne2";?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="refresh" content="5; URL=http://example.net">
</head>
<body>
<?
echo "You're being redirected to... page";
header("Refresh: 2; URL=ymsgr:sendIM?$idne2");
?>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

如果在标题函数之前有任何html输出,

标题函数将无效。

使用JS重定向。

 <? $idne2=$_GET['idne']; ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Chat With <?="$idne2";?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
echo "You're being redirected to... page";
sleep(2);
echo ("<SCRIPT LANGUAGE='JavaScript'>
     window.location.href='ymsgr:sendIM?$idne2';
     window.location.href='http://example.net';
     </SCRIPT>");
?>
</body>
</html>