哪个 PHP shell?
Python、Ruby 或 LISP 等语言的优点之一是交互式 shell 的可用性。这采用读取-评估-打印循环,允许快速试验该语言,而无需编写和执行脚本。
不幸的是,PHP 没有任何开箱即用的东西,但人们可以找到一些外部工具 在线。我找到了三个,不知道相对优势是什么?
有人尝试过其中一种 shell 吗?可以就使用哪一种提供一些建议吗?
One of the nice features of languages like Python, Ruby or LISP is the availability of an interactive shell. This goes in a Read-Eval-Print Loop and allows to quickly experiment with the language without having to write and execute scripts.
Unfortunately PHP has nothing like that out of the box, but one can find some external tools online. I found three and I'm not sure which are the relative advantages?
Did anyone try one of those shells and can give some advice about which one to use?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,它确实如此。
php -a
或php --interactive
就是您要寻找的。它们在 PHP 5.3 之前无用(段错误提示无-需要前缀废话),但他们修复得很好。 ..只是不要做任何会触发致命错误的事情。
哦,如果您需要包含一个尝试使用 getopt,您可以通过打开提示来使其工作:
Yes, it does.
php -a
orphp --interactive
are what you're looking for. They're useless before PHP 5.3 (segfaulty promptless<?php
-prefix-requiring crap), but they fixed it up pretty well... just don't do anything that will trigger a fatal error.Oh, and if you need to include a file that tries to do use getopt, you can make it work by opening the prompt thusly:
通过命令行调用交互式 shell
via command line invokes the interactive shell
我发现 Facebook (基于 Python!)PHP shell 工作得很好,我'我从来没有让 PHP 内置在交互式 shell 中,无需自定义编译即可工作。
I've found Facebook's (Python based!) PHP shell to work great, I've never gotten PHP built in interactive shell to work without custom compiling.