简体   繁体   English

如何同步帧

[英]How to synchronize frames

2 frames are sharing global variables 2帧共享全局变量

the second frame display depends on the variables set by the the php script of first frame 第二帧的显示取决于第一帧的php脚本设置的变量

Most of time it works .. but if the second frame is faster it's mess up 大多数时候它都可以工作..但是如果第二帧更快,那就搞砸了

how can i synchronize them ? 我该如何同步它们?

the second php script of one frame will wait till the other finishes 一帧的第二个php脚本将等到另一个完成

actually sleep(1) in the beginning improved things a lot but it's not very reliable since the first frame accesses db and the result depends on execution time 实际上,sleep(1)在开始时有很多改进,但是它不是非常可靠,因为第一帧访问db,结果取决于执行时间

finally i have done it using javascript. 终于我用JavaScript完成了。 The first script generates 第一个脚本生成

top.frames[1].location = .... top.frames [1] .location =...。

with parameter exec=1 参数exec = 1

initially the frame is called with different parameter exec=0 最初,使用不同的参数exec = 0调用框架

if ($_GET['exec'] == '0') return; if($ _GET ['exec'] =='0')返回; // in the beginning of second php //在第二个php的开头

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM