You are here: Re: Interactive PHP like Python « PHP Programming Language « IT news, forums, messages
Re: Interactive PHP like Python

Posted by j_macaroni on 04/17/06 07:00

I was hoping not to reinvent the wheel. Maybe someone else knows of a
module that does this. But I can see where it wouldnt be hard to
develop.

Henk Verhoeven wrote:
> Hi J,
>
> Why not build this yourself? This will only take you 10-30 minutes, much
> less then searching for an interactive shell. All you need is a web
> server that runs php.
>
> Make a php script that outputs a form with a textarea where you can
> enter some php code. The form targets the same php script. The script
> outputs the form once again with the same php code that was entered.
> Then, below the form, it outputs a DIV with fixed sizes and a scroll bar
> (style=). After outputting the <DIV styl= > tag, pass the code from the
> textarea passed to php's eval function. This will run the code. Anything
> that is printed from the eval'd php code will appear inside the DIV.
> Then print the end of the DIV and the end of the page. Or before the end
> of the page add another scrollable DIV with in between <PRE> tags
> print_r the eval result.
>
> If you want a new line to start after printing, add a simple function
> printLn($aValue) {
> print $aValue;
> print "<BR>\n";
> }
> and call it from the eval'd php code.
>
> WARNING: DO *NOT* put such a script on your website or any publically
> accessable web server directory as it would allow anyone to execute any
> php code on your server, allowing the reading of all its publically
> readable files, and probably hack you server.
>
> Greetings,
>
> Henk Verhoeven,
> www.phpPeanuts.org.
>
>
>
> j_macaroni@yahoo.com wrote:
> > I know you can start php -a and go into interactive mode. This works
> > well exept you have to keep putting <?php code here ; bla blah code ;
> >
> > Couple of problems with this.
> >
> > 1) Exits php when you make an error.
> >
> > 2) When you type a command; it displays the result but does not do an
> > automatic CR/LF
> >
> > Would be nice if it opened up in a window, and you just type and press
> > enter and see the result on the next line.
> >
> > Allow you to move up to a previous command and edit and press Enter.
> >
> > This would allow people to test commands and learn. You could even load
> > personal functions from a php file to do some testing
> >
> > Anyone know of a nice php interactive shell like Python's?
> >
> > Thanks
> >

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация