方法一: 通过 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
来源: https://www.php1.cn/detail/php-71dbde530a.html