Php exec()返回值1073740791

Php exec()返回值1073740791,php,windows,xampp,exec,exe,Php,Windows,Xampp,Exec,Exe,我试图在php中使用exec()运行.exe文件,并获取标准输出,然后在php中使用它。问题是,返回的$line并没有输出,返回的$return值为-1073740791。我找不到任何解决办法 代码: 我制作了“hello world”test.exe,如果我更改这一行: $file = 'src\\test.exe'; 输出为: file src\test.exe exists string(29) "src\test.exe 10 "cat AND dog"" array(1) { [0

我试图在php中使用exec()运行.exe文件,并获取标准输出,然后在php中使用它。问题是,返回的$line并没有输出,返回的$return值为-1073740791。我找不到任何解决办法

代码:

我制作了“hello world”test.exe,如果我更改这一行:

$file = 'src\\test.exe';
输出为:

file src\test.exe exists
string(29) "src\test.exe 10 "cat AND dog"" 
array(1) { [0]=> string(13) "Hello, World!" } 
int(0) 
docHello, World!.txt
所以text.exe可以工作

当我从另一个位置从终端运行我的程序时,这是很奇怪的。从src它工作,从父文件夹它不。

请帮帮我!我在windows上使用XAMPP和Apache


PS:这是我的第一个问题,sry为英语。

显然你的
中缀到后缀和求值.exe使用了“当前目录”中的一些数据。
test.exe
可能没有。(因此,当从另一个目录调用时,前者会消失)一个可能的解决方案是在调用函数之前先在php中插入src目录(没有“src\”)。是的,谢谢,我通过将php文件放入src\目录并更改文件路径来修复它。
$file = 'src\\test.exe';
file src\test.exe exists
string(29) "src\test.exe 10 "cat AND dog"" 
array(1) { [0]=> string(13) "Hello, World!" } 
int(0) 
docHello, World!.txt