PHP返回变量代码?

PHP返回变量代码?,php,exec,Php,Exec,我正在测试php exec命令: 我得到的结果代码是127 我的php代码是: <? print "<br>executing 'hello':<br><b>"; exec ("hello", $output, $result); var_dump($output); print "<br>$result"; print "<br></b>end

我正在测试php exec命令:

我得到的结果代码是127

我的php代码是:

<?

print "<br>executing 'hello':<br><b>";
exec ("hello", $output, $result);
var_dump($output);
print "<br>$result";
print "<br></b>end hello.";


print "<br><hr><br>";


print "<br>executing 'dir':<br><b>";
exec("dir", $output2, $result2);
var_dump($output2);
print "<br>$result2";
print "<br></b>end dir.";

?>
php文档(据我所知)说:

返回值

如果返回_var参数 与输出一起出现 参数,然后返回 将写入已执行的命令 对该变量进行修改

…但没有输出可能性列表或查找它们的方法

有什么建议吗?

返回代码127表示找不到指定的过程


假设您在Windows上,

返回代码可能有点任意。但基本上,任何非零返回值都是错误的。对于一些常见的错误代码,但通常情况下,除非您使用的是特定的程序,否则更容易假设非零=发现了一些错误,而不是尝试将许多不同的程序映射到特定的错误代码。

exec()对外部文件进行操作,并从那里或从操作系统接收返回代码。如果127来自操作系统,则表示在定义的路径中找不到该文件


另一方面,如果127来自正在运行的应用程序,则必须检查该应用程序的文档,以了解其含义。

返回值完全是任意的。当你编写一个程序时,你可以让它返回你想要的任何值。在PHP中,您可以使用以下语言构造:

<?php
exit(33);

我在Linux上,但这帮了大忙!
<?php
exit(33);