作者:qwj6069649 | 来源:互联网 | 2018-04-05 18:43
方法一:通过COOKIE交互。
一共是三个文件,分别为:index.htm,action.php,main.htm
原理为前台页面main.htm和后台action.php通过页面框架 index.htm组织起来,将action.php的页面宽度设为0,这样并不影响显示。action.php将信息放入COOKIE中,main.htm通过读取 COOKIE来实现交互。在main.htm中也可以通过重新读取action.php 来实现控制后台CGI程序。
index.htm
代码如下:
action.php
代码如下:
srand((double)microtime()*1000000);
$result=rand(0,100);
setCOOKIE("action",$result,time()+900,"/");
?> main.htm
代码如下:
当前参数为
重新读取COOKIE 方法二:直接通过parent.*.*来实现交互。
一共是三个文件,分别为:index.htm,action.php,main.htm,其中index.htm和前面的一样。
原理为通过parent.rightFrame.test.current_COOKIE.value直接传递信息。
action.php
代码如下:
srand((double)microtime()*1000000);
$result=rand(0,100);
?>
main.htm
代码如下: 当前参数为
重新读取COOKIE