Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么js php生成的位置引用在IE8中不起作用?_Php_Javascript_Internet Explorer_Internet Explorer 8 - Fatal编程技术网

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

为什么js php生成的位置引用在IE8中不起作用?,php,javascript,internet-explorer,internet-explorer-8,Php,Javascript,Internet Explorer,Internet Explorer 8,为什么js php生成的位置引用在IE8中不起作用 <script> <?php session_start(); $_SESSION['admintermorol']=false; echo "window.location='".$_SERVER['HTTP_REFERER']."';"; ?> </script> 我不确定,但是你可以用纯php来做,替换 echo "window.location='".$_S

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

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


我不确定,但是你可以用纯php来做,替换

echo "window.location='".$_SERVER['HTTP_REFERER']."';"; 

对不起,这有点错

将代码移到页面顶部(不在脚本标记内)


你说“不起作用”是什么意思?什么得到回应?你是说window.location.href吗?我已经尝试了两个版本@madflow。但是Dale所回答的很好。我相信问题在于
session\u start()
调用位于页面的“中间”,必须在将任何内容发送到浏览器之前调用session\u start()。没关系,该文件的目标是将admintermorol设置为false,然后返回调用页面。
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"));
?>