PHP的return_var代码? [英] PHP return_var codes?
问题描述
我正在测试php exec命令:
I'm testing the php exec command:
我将返回结果代码127.
and I'm getting back a result code of 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.";
?>
输出为:
executing 'hello':
array(0) { }
127
end hello.
executing 'dir':
array(2) { [0]=> string(42) "bs1.jpg hello index.htm ml1_1.jpg pp1.jpg" }
0
end dir.
据我所能找到的php文档说:
The php documentation (as far as I could find) says this:
return_var
return_var
如果return_var参数 与输出一起存在 参数,然后返回状态 执行的命令将被写入 到这个变量.
If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable.
...但是没有输出可能性的列表或查找它们的方法.
...but does not have a list of output possibilities or a way to look them up.
有什么建议吗?
推荐答案
返回码可能有点武断.不过,基本上,任何非零的返回值都是错误. 这是一些常见列表,但通常除非您正在使用相对于尝试将多个不同的程序映射到特定的错误代码,相对于将多个不同的程序映射到特定的错误代码,更容易地假设非零=发现了某个错误.
Return codes can be a bit arbitrary. Basically though, any non-zero return value is an error. Here's a list of some common ones, but typically, unless you're working with a specific program, it's easier to just assume non-zero = some error was found, as opposed to trying to map a number of different programs to specific error codes.
这篇关于PHP的return_var代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!