为什么这个js-php生成的位置引用在IE8中不起作用?
<script>
<?php
session_start();
$_SESSION['admintermorol']=false;
echo "window.location='".$_SERVER['HTTP_REFERER']."';";
?>
</script>
答案 0 :(得分:2)
我不确定,但你可以用纯PHP做到这一点,替换
echo "window.location='".$_SERVER['HTTP_REFERER']."';";
带
exit(header("Location: {$_SERVER['HTTP_REFERER']}\r\n"));
抱歉,这有点不对
将代码移动到页面顶部(不在脚本标记内)
<?php
session_start();
if ( !isset($_SESSION['admintermorol']))
{
exit(header("Location: {$_SERVER['HTTP_REFERER']}\r\n"));
}
?>
或者(现在我知道)你可以这样做: - )
<?php
session_start();
$_SESSION['admintermorol'] = FALSE;
exit(header("Location: {$_SERVER['HTTP_REFERER']}\r\n"));
?>