交互式PHP shell如何工作? [英] How does the interactive php shell work?

查看:199
本文介绍了交互式PHP shell如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP的交互式shell中使用命令 php -a 在终端,但没有命令正在工作。我甚至尝试一个简单的 2 * 2 ,我没有结果。

I am in the interactive shell for PHP using the command php -a in a terminal but no commands are working. I even try a simple 2 * 2 and I get no results.

我做错了什么它工作?

推荐答案

交互式shell的文档,Ryan P.的第一个注释有一些显着的信息:

On the documentation for the interactive shell, the first note by Ryan P. has some notable information:


Interactive Shell and Interactive Mode are not the same thing, despite the similar names and functionality.

如果您键入 php -a 并获得Interactive Shell的响应,后面紧跟一个 php> 提示,您有交互式shell可用(PHP是用readline支持编译的)。如果您得到交互模式启用的响应,您没有交互式shell可用,本文不适用于您。

If you type php -a and get a response of 'Interactive Shell' followed by a php> prompt, you have interactive shell available (PHP was compiled with readline support). If instead you get a response of 'Interactive mode enabled', you DO NOT have interactive shell available and this article does not apply to you.

所以如果你只有交互模式启用,那么你只能输入PHP代码,然后当你完成后,发送PHP一个EOF来执行它。

So if you get only "Interactive mode enabled", then you'll only be able to type in PHP code and then when you're done, send PHP an EOF to execute it.

这可能不是你想要的。您可以改用 phpsh

This is probably not what you want. You may want to look into phpsh instead.

这篇关于交互式PHP shell如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆