0
我需要這兩個iframe形成工作獨立(異步),但是當我同時提交兩個表單時,第二個iframe報告「致命錯誤:最大執行時間超過30秒C:\第二行加上wamp \ www \ iframe2.php(當iframe1查詢是一個很長的進程時),或者第二個iframe在第一個進程完成後返回數據(當iframe1查詢是一個短進程時)。 現在,我需要保持會話以驗證用戶登錄。 我需要你的幫助,我的朋友們!感謝session_start問題當並行運行進程
的index.php
<html>
<head>
<title></title>
</head>
<body>
<iframe src="iframe1.php" width="300" height="400"></iframe>
<iframe src="iframe2.php" width="300" height="400"></iframe>
</body>
</html>
iframe1.php(返回查詢結果)
<?php
session_start();
if($_SESSION['user'])
$data="Valid user";
else
header("location: login.php");
set_time_limit(120);
require_once("config.php"); //db conections
if($_POST)
{
//query (long process)
$data.= ""; // concatenated string with query results
}
?>
<html>
<head>
<title></title>
</head>
<body>
<?php echo session_id();?>
<form method="post">
ini:<input type="text" name="var1" value="" /><br />
fin:<input type="text" name="var2" value="" /><br />
<input type="submit" value="Send" />
</form>
Result:<br />
<?php
if(isset($data))
echo session_id()."<hr>".$data;
?>
</body>
</html>
iframe2.php(只返回123456)
<?php
session_start();
if($_SESSION['user'])
$data="Valid user";
else
header("location: login.php");
if($_POST)
{
$data = "123456";
}
?>
<html>
<head>
<title></title>
</head>
<body>
<?php echo session_id();?>
<form method="post">
<input type="text" name="inpt" />
<input type="submit" value="frame2" />
</form>
Result:<br />
<?php
if(isset($data))
echo session_id()."<hr>".$data;
?>
</body>
</html>
爲什麼在'iframe2.php'中沒有'set_time_limit(120);'? – Orbling