PHP Exec command - How to pass input to a series of questions

前端 未结 3 1586
误落风尘
误落风尘 2021-01-12 11:47

I have a program on my linux server that asks the same series of questions each time it executes and then provides several lines of output. My goal is to automate the input

3条回答
  •  情歌与酒
    2021-01-12 12:25

    $out = array();
    //add elements/parameters/input to array
    string $execpath = "my/path/program ";
    foreach($out as $parameter) {
      $execpath += $parameter;
      //$execpath += "-"+$execpath; use this if you need to add a '-' in front of your parameters.
    }
    exec($execpath);
    

提交回复
热议问题