看看这个PHP手册页
http://php.net/manual/en/features.commandline.php
特别是
<?phpecho "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;}echo "n";echo "Thank you, continuing...n";?>


