2

shell_exec()

我正在做一个使用这样的shell_exec()函数的 PHP 站点:

$file = "upload/" . $_FILES["file"]["name"];

$output = shell_exec("leaf $file");
echo "<pre>$output</pre>";

其中叶子是位于我的脚本同一目录中的程序,但是当我尝试在服务器上运行此脚本时,我什么也没得到。


exec()

如果我尝试exec()这样使用:

exec("sh " . getcwd() . "leaf -h", &$output);
echo "<pre>";
print_r(&$output);
echo "</pre>";

我懂了:

大批
(
)

如果我做同样的事情,但使用echo而不是print_r,我只得到这个:Array

我可以做什么?

4

1 回答 1

2

您是否尝试将完整路径与“叶子”参考一起使用?

$output = shell_exec("/var/local/leaf $file");
于 2010-05-05T17:37:38.357 回答