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 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python