PHPExec(“phonegap-v”)没有';行不通

PHPExec(“phonegap-v”)没有';行不通,php,cordova,Php,Cordova,这是我的代码: exec('phonegap -v 2>&1',$output, $retval); echo 'Return value: ' . $retval; print_r($output) 返回: 返回值:1Array([0]=>path.js:8[1]=>throw new TypeError('path必须是字符串。Received'+[2]=>^[3]=>[4]=>TypeError:path必须是字符串。在assertPath(path.js:8:11)[6]

这是我的代码:

exec('phonegap -v 2>&1',$output, $retval);
echo 'Return value: ' . $retval;
print_r($output)
返回:

返回值:1Array([0]=>path.js:8[1]=>throw new TypeError('path必须是字符串。Received'+[2]=>^[3]=>[4]=>TypeError:path必须是字符串。在assertPath(path.js:8:11)[6]=>在Object.posix.join(path.js:479:5)[7]=>在Object。(/home/phonegap/node-v4.4.5-linux-x64/lib/node_modules/phonegap/node_modules/phonegap build/lib/common/config/global.js:17:28)[8]=>at Module.compile(Module.js:409:26)[9]=>at Object.Module.Module.\u扩展..js js 416:10][10]=>at Module load(Module js 343:32)[11]=>at Function.Module js 300:12]=>at Module.require(Module.js:353:17)[13]=>at require(internal/Module.js:12:17)[14]=>at Object.(/home/phonegap/node-v4.4.5-linux-x64/lib/node_modules/phonegap/node_modules/phonegap build/lib/common/config.js:9:13))

当我在bash shell中执行该命令时,它可以工作。但在我的PHP脚本中,它不会。有什么想法,为什么?

使用(```)或您需要解释为什么这可能有助于解决问题。