其實就是一條Linux命令,如下:
sudo update-alternatives --config php
會出現下面選項:
There are 2 choices for the alternative php (providing /usr/bin/php). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/php7.1 71 auto mode 1 /usr/bin/php7.0 70 manual mode 2 /usr/bin/php7.1 71 manual mode Press <enter> to keep the current choice[*], or type selection number:
輸入其中一項數字即可實現php版本切換
如何判斷版本是否切換成功?php -v
命令進行前后版本對比即可看出。