note 98642 added to features.commandline.interactive
| From: | Anonymous at osu1 dot php dot net | Date: | Mon, 28 Jun 2010 22:41:18 +0000 |
| Subject: | note 98642 added to features.commandline.interactive | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170531@lists.php.net to get a copy of this message | ||
It seems the interactive shell cannot be made to work in WIN environments at the moment.
Using "php://stdin", it shouldn't be too difficult to roll your own. You can
partially mimic the shell by calling this simple script (Note: Window's cmd already has an
input history calling feature using the up/down keys, and that functionality will still be available
during execution here):
<?php
$fp = fopen("php://stdin", "r");
$in = '';
while($in != "quit") {
echo "php> ";
$in=trim(fgets($fp));
eval ($in);
echo "\n";
}
?>
Replace 'eval' with code to parse the input string, validate it using is_callable and
other variable handling functions, catch fatal errors before they happen, allow line-by-line
function defining, etc. Though Readline is not available in Windows, for more tips and examples for
workarounds, see http://www.php.net/manual/en/ref.readline.php
----
Server IP: 69.147.83.197
Probable Submitter: 70.124.94.109
----
Manual Page -- http://www.php.net/manual/en/features.commandline.interactive.php
Edit -- https://master.php.net/note/edit/98642
Del: integrated -- https://master.php.net/note/delete/98642/integrated
Del: useless -- https://master.php.net/note/delete/98642/useless
Del: bad code -- https://master.php.net/note/delete/98642/bad+code
Del: spam -- https://master.php.net/note/delete/98642/spam
Del: non-english -- https://master.php.net/note/delete/98642/non-english
Del: in docs -- https://master.php.net/note/delete/98642/in+docs
Del: other reasons-- https://master.php.net/note/delete/98642
Reject -- https://master.php.net/note/reject/98642
Search -- https://master.php.net/manage/user-notes.php