首先在phpstudy中安装composer。
然后找到php的安装目录,我的是在 D:\phpstudy_pro\Extensions\php\php7.3.4nts
找到 composer 的安装目录,我的是在 D:\phpstudy_pro\Extensions\composer1.8.5
修改一下这个目录中的 composer.bat 文件为:
@echo OFF
:: in case DelayedExpansion is on and a path contains !
setlocal DISABLEDELAYEDEXPANSION
D:\phpstudy_pro\Extensions\php\php7.3.4nts\php "%~dp0composer.phar" %*
然后运行升级命令: composer self-update
成功了!
D:\phpstudy_pro\Extensions\composer1.8.5>composer self-update
Updating to version 2.0.9 (stable channel).
Downloading (100%)
Use composer self-update --rollback to return to version 1.8.5
再试试:
D:\phpstudy_pro\Extensions\composer1.8.5>composer self-update
You are already using the latest available Composer version 2.0.9 (stable channel).