终端中输入
brew search php
brew install php@7.2
brew link php@7.2
brew link 出现warning执行(使用zsh的可将bash_profile改为zshrc)
echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.bash_profile