【问题标题】:PHP - Execute code from terminal, ubuntu serverPHP - 从终端执行代码,ubuntu 服务器
【发布时间】:2012-09-19 20:38:54
【问题描述】:

我知道你可以通过运行 PHP 的 linux 从终端运行 php 文件...即"php script.php" ...但是有没有程序可以让你直接将php输入终端(通过任何中间程序)并输出结果? IE。在终端中,测试 php 全局变量,如 getinfo() 等。任何帮助都会很棒,我想通过一种运行时终端来测试功能和命令。谢谢!

【问题讨论】:

    标签: php terminal


    【解决方案1】:

    php -a(自 PHP 5.1 起)应该做你想做的事。

    http://php.net/manual/en/features.commandline.interactive.php

    【讨论】:

    • 如果你输入'php -a'并得到'Interactive Shell'的响应,然后是'php>'提示,你就有了可用的交互式shell(PHP是用readline支持编译的)。相反,如果您收到“启用交互模式”的响应,则说明您没有可用的交互式 shell...link 如果没有 shell,您可以尝试建议的方法 here
    • @CrandellWS 非常感谢您的提示!!!我知道了Interactive mode enabled,但我不知道。
    • .php 文件怎么样?\
    【解决方案2】:
    【解决方案3】:

    您可能喜欢一个名为 PHP Shell Terminal 的程序:http://sourceforge.net/projects/phpterm/

    【讨论】:

    • 这更像是一个用 PHP 编写的 SSH 客户端,而不是一个调试 PHP 的工具。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-06
    • 1970-01-01
    • 1970-01-01
    • 2012-03-06
    • 2012-06-25
    • 1970-01-01
    相关资源
    最近更新 更多