0

为什么这个 js-php 生成的位置引用在 IE8 中不起作用?

<script>
<?php
    session_start();
        $_SESSION['admintermorol']=false;
        echo "window.location='".$_SERVER['HTTP_REFERER']."';";
?>
</script>
4

1 回答 1

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"));
?>
于 2012-04-17T18:49:05.927 回答