我需要一个接一个地运行2条命令,exec
但它不会运行。
$command1 = 'cd '.$destination.''; //open destination folder (e.g. public_html)
$command2 = 'git clone '.$repos->repository.''; //make clone
$sshConnection1 = exec($command1); // run first command(open folder)
$sshConnection = exec($command2); //run second command (make clone)
之前,我创建了这个问题我看了一些建议的主题,如这一个。添加"&"
等等,但是没有运气。
请告诉我我该怎么做才能成功运行两个命令。
您可以通过将以下两个命令exec()
组合在一起,将两个命令简单地放入一个调用中&&
:
exec("cd $destination && git clone {$repos->repository}");
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句