BRADERY Posted January 30, 2011 Share Posted January 30, 2011 So say I have a script, it calls for a text file in the script. Instead of putting the name of the text file is there a way I can run the script then type the name of the file in the CLI? Link to comment https://forums.phpfreaks.com/topic/226096-php-script-in-cli-with-user-imput/ Share on other sites More sharing options...
.josh Posted January 30, 2011 Share Posted January 30, 2011 You can use $_SERVER['argv'] to get arguments passed. Example: CLI: php.exe script.php filename.txt script.php print_r($_SERVER['argv']); output: Array ( [0] => script.php [1] => filename.txt ) Link to comment https://forums.phpfreaks.com/topic/226096-php-script-in-cli-with-user-imput/#findComment-1167165 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.