<?php // $cmd = "cd /www/wwwroot/fj.com/thinkphp5/ && sudo git reset --hard origin/cs && sudo git pull origin cs && sudo git pull --all && sudo git pull origin cs 2>&1"; // $cmd = "cd /www/wwwroot/nwnd_php2/ &&sudo git fetch --all &&sudo git reset --hard origin master && sudo git pull --all && sudo git pull origin master 2>&1"; // $cmd = "cd /www/wwwroot/nwnd_php2/ && sudo git pull origin cs 2>&1"; $cmd = "cd /www/wwwroot/test/thinkphp5_test_project/ && git pull 2>&1"; $res = array(); exec($cmd,$res,$i); var_dump($res); echo '</br>'; // $ip = "www.baidu.com"; // exec("curl $ip ", $arr, $i); // echo "信息:<br />"; // print("<xmp>"); // print_r($arr); // print("</xmp>"); echo "状态:".$i."<br />"; echo "PS:状态0为执行成功,1为执行失败!"; ?>
<?php$cmd = "cd /www/wwwroot/new.zaomz.com/nwnd_php/ &&sudo git reset --hard origin/pt && sudo git pull origin pt && sudo git pull --all && sudo git pull origin pt 2>&1";//$cmd = "cd /www/wwwroot/new.zaomz.com/nwnd_php/ &&sudo git log &&sudo git pull --all && sudo git pull origin master 2>&1";//$cmd = "cd /www/wwwroot/new.zaomz.com/nwnd_php/ &&sudo git fetch --all &&sudo git reset --hard origin/pt && sudo git pull --all && sudo git pull origin pt 2>&1";$res = array();exec($cmd,$res);var_dump($res);?>
来源:https://www.cnblogs.com/ygyy/p/12649934.html