我在前面的问题中看到了很多键盘选项,但我正在寻找可以放在OS X上的CLI PHP程序中的东西。在我的代码中,我在循环中查看每个jpg,但在每张照片之后打开我想立即以编程方式将控制(激活)返回到我的终端窗口,而不需要任何按键。因为剩下的代码需要在照片出现后输入。
代码段:
<?php
system("stty cbreak");
// View the jpg images one at a time
$files = glob("images/*.jpg");
foreach($files as $jpg){
// View jpg photo in Preview window, which makes Preview the active window
$cmd = "open $jpg";
exec($cmd);
// Return to terminal window(terminal app?) somehow as active window
// Other code executing in terminal window that requires user input, etc.
?>