我的html页面中有一个表单运行一个php页面,并在iframe上实时显示结果,操作时间长约20分钟,我试图实现第二个按钮,停止运行终止进程, php函数有效,但问题是,如果我点击停止按钮,该函数无法启动。这是HTML:
<div id="allign">
<iframe id="frame" name="my_iframe" height="520" width="1100" allign="right" frameBorder="0" ></iframe>
</div>
<form action="action_calibration.php" method=post target="my_iframe">
<br><br>
<input type="radio" name="type" value="fast" checked>Fast Calibration
<br><br>
<input type="radio" name="type" value="old">Old Calibration
<br><br>
<input type="checkbox" name="ScanVPlus" value="yes" checked>Scan Vcth vs VPlus
<br><br>
<input type="checkbox" name="Bitwise" value="yes">Bitwise Offset Tuning
<br><br>
<input type="checkbox" name="All_channel" value="yes">Calibration using all channel
<br><br>
Output Folder:<input type="textfield" name="output" value="Results/">
<br><br>
Hw Description File:<input type="textfield" name="Hw Description File " value="settings/Calibration2CBC.xml">
<br><br>
<input type="submit" name="exec" value="Submit">
<input type="submit" name="exec1" value="STOP">
<br><br>
</form>
action_calibration.php文件的最后一部分是这样的:
$handle = popen("source ".$command, "r");
$continue=TRUE;
while ((!feof($handle))&& $continue) {
$data = fgets($handle);
print $data."<br/>";
echo $continue;
if(isset($_POST['exec1'])){
$continue=FALSE;
}
}
shell_exec("kill $(pidof calibrate)");
感谢您的帮助。
答案 0 :(得分:0)
试试这个......
<input type="submit" name="exec" value="Submit">
<input type="submit" name="exec1" value="STOP">
$handle = popen("source ".$command, "r");
$continue=TRUE;
while ((!feof($handle))&& $continue) {
$data = fgets($handle);
print $data."<br/>";
echo $continue;
if(isset($_POST['exec1'])){
$continue=FALSE;
}
}
shell_exec("kill $(pidof calibrate)");