特定のサーバーのクライアント アプリケーションである main.html ページがあります。main.php は 3 つのフレームを持つウィンドウです。
main.html
<frameset frameborder=no border=0>
<frame name='top1' src='top1.php' frameborder=no scrolling=no>
<frame name='top2' src='top2.php' frameborder=no scrolling=no>
<frame name='firstpage' src='firstpage.php' frameborder=no scrolling=auto>
</frameset>
firstpage.php
<?php
....
....
require_once("connection.php");
// connection.php is a class which opens a socket and establishes with another server.
set_time_limit(0);
ignore_user_abort();
function parse($line) {
//parses $line returns $a which contains some data etc
....
return $a;
}
$connect= new Connection();
.....
$line=$connect->socket_read(1028);
.....
while ($i<200) {
$GLOBALS[userdata][$i]=parse($line);
.......
}
?>
firstpage.php は大きなスクリプトであり、読みやすさのために firstpage.php の大部分を削除しました。connect.php と firstpage.php は、私が望むとおりに機能しています。
さらに処理するために、top1.php と top2 で $GLOBALS[userdata] を使用できるようにする必要があります。connect.php を再度インスタンス化せずに $GLOBALS[userdata] にアクセスできる方法はありますか? (top1.php と top2.php で実行したいデータ処理は、ここでは説明できない理由により、firstpage.php では実行できません。) サーバーからのデータが既に firstpage.php にあるため、connect.php を再インスタンス化できません。サーバーから再送信されません。
firstpage.php が無限に実行されるため、 $GLOBALS が書き込まれないことに気付きました。$GLOBALS[userdata][$i]=parse($line); の直後に session_write_close を試行しました。while ループで。しかし、それは役に立ちませんでした。
また、top1.php、top2.php、および firstpage.php の SESSIONID が同じであることもわかりました。
誰かが私を正しい方向に向けることができますか?
ありがとう!!