例如,我有这个bash脚本:
#!/usr/bin/env php
<?php
$options = ['Option 1', 'Option 2'];
echo "Please choose an option:\n";
foreach ($options as $key => $value) {
echo $key . ' - ' . $value . "\n";
}
shell_exec('read OPTION');
有没有办法获得OPTION
值并将其传递给PHP环境?