1

为什么ssh2_exec函数不传递三个以上的参数?

$stream_1 = ssh2_exec($ssh, "/root/Script/Auto_Traces/show_ng_trace.sh $a $b $c $d $e");

在这种情况下,只有$a $b $c通过而不是$d$e,我该如何解决?

4

1 回答 1

1

我怀疑前 3 个变量中的某些变量中有空格,因此它们被视为多个参数。然后最后两个参数被忽略。如果任何变量中有空格(或其他特殊字符),您应该转义它们。

$ae = escapeshellarg($a);
$be = escapeshellarg($b);
// repeat for the rest of variables
$stream_1 = ssh2_exec($ssh, "/root/Script/Auto_Traces/show_ng_trace.sh $ae $be $ce $de $ee");
于 2017-06-30T22:27:01.543 回答