Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.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
Javascript Iframe会话有时不工作_Javascript_Php_Iframe - Fatal编程技术网

Javascript Iframe会话有时不工作

Javascript Iframe会话有时不工作,javascript,php,iframe,Javascript,Php,Iframe,您好,我有一个iframe和.php页面。我试图在刷新页面时保留该页面。我使用session阻止iframe返回到它的默认src=”“页面。我在电影里看到了这个把戏。但问题是,当我尝试刷新时,有时它会阻止返回到它的默认src=“”页面,有时它会返回到它的默认src=“”页面。有什么问题 <?php session_start(); // before any output to the user-agent / browser /screen!!! print('<iframe sr

您好,我有一个iframe和.php页面。我试图在刷新页面时保留该页面。我使用session阻止iframe返回到它的默认src=”“页面。我在电影里看到了这个把戏。但问题是,当我尝试刷新时,有时它会阻止返回到它的默认src=“”页面,有时它会返回到它的默认src=“”页面。有什么问题

<?php
session_start(); // before any output to the user-agent / browser /screen!!!
print('<iframe src="'.$_SESSION['last_visited'].'"></iframe>')
?>

<li><a href="1.php" target="contents">1</a></li>
<li><a href="2.php" target="contents">2</a></li>
<li><a href="3.php" target="contents">3</a></li>
<li><a href="4.php" target="contents">4</a></li>

<iframe name="contents" src="index.html" id="iframe1" frameborder="0"></iframe>

你能详细说明一下
吗?但问题是它有时有效有时无效。
为什么无效,控制台中有没有错误?@Ryan我更新了我的问题。对不起
<?php
session_start(); // before any output to the user-agent / browser /screen!!!
$_SESSION['last_visited'] = $_SERVER['REQUEST_URI'];
?>