【问题标题】:executing a prompt command from within my php/html code从我的 php/html 代码中执行提示命令
【发布时间】:2019-10-08 15:17:36
【问题描述】:

我有一个 puppeteer 程序,我通过在命令提示符中输入 c:\myProgram>node index.js 来执行它。我不想在命令提示符中输入此命令,而是希望从我的 PHP 程序运行命令。
类似这样的伪代码:

When button is clicked,
   call function

函数会在哪里为我在命令提示符中输入命令。我正在使用 Visual Studio Code,可以使用集成终端(我认为)。

在我的示例中,什么代码可以替换 call fucntion

【问题讨论】:

  • exec('c:\myProgram>node index.js');
  • 这个问题和 C# 有什么关系?

标签: javascript php node.js


【解决方案1】:

您需要使用exec()system()passthru() 函数。

还有另一个 SO 帖子,其中包含所有 3 的详细信息。我个人更喜欢 passthru()

exec() vs system() vs passthru()

这里稍微更高级地使用 passthru() 取决于你需要什么,你应该被这两个链接覆盖。

passthru() vs shell_exec()

【讨论】:

    猜你喜欢
    • 2012-03-20
    • 1970-01-01
    • 1970-01-01
    • 2020-11-10
    • 2010-09-16
    • 2019-08-04
    • 2010-11-18
    • 2012-07-08
    • 1970-01-01
    相关资源
    最近更新 更多