gpt4 book ai didi

javascript - 当 max_execution_time 结束时如何通过正确处理给出用户定义的超时消息

转载 作者:行者123 更新时间:2023-11-29 23:44:17 24 4
gpt4 key购买 nike

我正在设计自定义查询页面,用户可以在其中触发查询并获得所需的结果。在我的数据库中,我有数千万条记录,显然执行起来需要大约 10 到 15 分钟的时间。超时页面终止并且 php 脚本下面的代码不会执行,因此它不会显示在设计和页脚下面。

请让我知道如何正确处理超时,以便整个页面执行并提供正确的用户定义的超时消息,如果执行时间超过,还应在设计和页脚下方提供。

这就是我正在尝试做的事情......

 <form onsubmit="custom.php;" id="usrform" method="post">
<textarea id="tarea" placeholder=" Example: select malindex,malname,virustype,filetype,count from CT_DETECTIONS;" name="query" form="usrform" style="width:800px;height:100px;"></textarea>
<br>
<br><input type="submit" value="Submit Query" onclick="validate();">
</form>
<br>
<?php

//DB connection

if(isset($_POST['query'])&& $_POST['query']!='')
{
$x = $_POST['query'];
$result = mysqli_query($con,$x);
if(!$result)
{
$msg='<b>Error: </b>Invalid query. Enter a valid query. Please refer to Database Schema <a href="tableinfo.html"><b style="color:black;">here</b> </a>';
}
else
{
$x="<b>Query: </b>" .$_POST['query'];
//fetching rows and drawing google chart table

<?php echo $x;
}
}?>
<div id="valid" style="color:red;">
<?php echo $msg; ?>
</div>
<div style="color:red">
<lable id="myP"> </lable>
</div>
</div>
</div>

<div id="visualization" style="width:800px; height: 450px;color:black;margin-left:22px;"></div>
</div>
</div>

请告诉我如何处理由于超时而终止的页面

最佳答案

您可以使用 set_time_limit(60*60) 更改时间限制; www.php.net这会将其设置为 1h 或查看 Stackoverflow 上的这篇文章.

关于javascript - 当 max_execution_time 结束时如何通过正确处理给出用户定义的超时消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26033007/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com