在 shell 中运行以下命令时,
curl -F file=@filename http://192.168.0.1
产生以下输出:
Accuracy = 0% (0/1) (classification)
Accuracy = 0% (0/1) (classification)
Accuracy = 0% (0/1) (classification)
Accuracy = 0% (0/1) (classification)
verdict = success!
当我在 php 中运行它时,要么使用shell_exec()
,要么使用exec()
反引号运算符,
$verdict = `curl -F file=@$filename $url`;
我得到以下输出:
Accuracy = 0% (0/1) (classification)
Accuracy = 0% (0/1) (classification)
Accuracy = 0% (0/1) (class
输出被截断为正好 100 个字符。我一生都无法弄清楚为什么会这样。为什么会这样,如何在 php 变量中获得完整的输出?