php - 使用 PHP 和参数执行外部程序

标签 php

我希望使用 PHP 运行外部程序并提供一些参数,例如:

exec('C:\\Program Files\\iNFekt\\infekt\\infekt-cmd.exe -S --utf-16 '.$nfoFile, $output, $return_var);

但是没有任何反应,$output 是空数组,$return_var 是 1

我的错误是什么?

最佳答案

使用shell_exec获取输出:

$output = shell_exec('C:\\Program Files\\iNFekt\\infekt\\infekt-cmd.exe -S --utf-16 '.$nfoFile');

来自Manual :

shell_exec — Execute command via shell and return the complete output as a string

关于php - 使用 PHP 和参数执行外部程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48499248/

相关文章:

php - stdClass 类的对象无法转换为字符串 - laravel

php - 计算有特价的天数

javascript - 在每次 href 出现之前放置文本?

php - 为 CMS 制作一个 SEO 友好的 URL

php - 直接在FTP上制作wordpress主题会不会更快?

使用 JSON 从 MYSQL 到 Javascript 对象的 PHP 数组

php - mysql_fetch_array() 是什么意思

php - 使用 MySQL 和 PHP 高效处理大量数据

PHP 域可用性脚本 exec() 函数替代

php - 获取sql查询的开始/结束时间