我希望能够让一个 PHP 程序等待用户的输入。例如:
我应该怎样做第二步? (可能吗?)
The php man page for the cli has a comment here detailing a solution, (copied here for anyone else looking)
<?php echo "Are you sure you want to do this? Type 'yes' to continue: "; $handle = fopen ("php://stdin","r"); $line = fgets($handle); if(trim($line) != 'yes'){ echo "ABORTING!\n"; exit; } fclose($handle); echo "\n"; echo "Thank you, continuing...\n"; ?>