duanci5913 2017-02-09 11:34
浏览 47
已采纳

在执行时从PhP运行连续的Python脚本和重新加载页面

<?php 
  $time=$_GET[ 'time'];
  $date=$_GET[ 'date'];
  if($time !="" & $date !="" ){ 
    $hour=s ubstr($time,0,2);
    $minute=s ubstr($time,3,2);
    $day=substr($date,8,2);
    $month=substr($date,5,2);
    $year=substr($date,0,4);
    $execute=exec("python ..\alarm.py $year $month $day $hour $minute"); 
  }
?>


<form action="index.php" method="get">
  <input type='date' name='date'>
  <input type='time' name='time'>
  <input type='submit' value='setAlarm'>
</form>

So i am working on some Code that should do the following:

  1. Clicking a Submit-button on my index.php should execute a python-script stored on the Server and submitting the params of the form
  2. The python script, which is a script that is continuously excecuting an alarm (it sets an alarm an waits until then to execute it -> so it is supposed to run until the alarm is finished)
  3. After the python script was started from the php script, the index.php should reload.

Right now, it all works without the reloading of the index.php. The file is being executed and after manually reloading the page, the index.php Shows me all running alarm.py scripts, which is all i want.

So is there a way, to force the reloading of the page, after the executing from php started?

</div>
  • 写回答

1条回答 默认 最新

  • doulingzhuang3079 2017-02-09 12:03
    关注

    You can use "&" et the end :

    exec("python ..\alarm.py $year $month $day $hour $minute &");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里