Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

终端切换php版本需求 #168

Open
ljyljy0211 opened this issue Dec 23, 2024 · 1 comment
Open

终端切换php版本需求 #168

ljyljy0211 opened this issue Dec 23, 2024 · 1 comment

Comments

@ljyljy0211
Copy link

由于我有许多不同php版本的项目,在终端需要经常切换版本,来执行不同的php版本命令,这个时候每次都需要去面板的php版本管理的地方,手动将php版本添加的环境变量,操作多了就很麻烦,是否可以增加终端直接切换php版本的功能,类似于mac的 brew-php-switcher php版本 这个命令,那就更方便了
20241223185959

@zhaozhatian
Copy link

一个简单的脚本就可以实现。有多个就自己再增加....
#!/bin/bash

PHP_VERSION=$1

if [ "$PHP_VERSION" == "7.4" ]; then
export PATH="/d/webstudy/PhpWebStudy-Data/app/php-7.4.33/:$PATH"
elif [ "$PHP_VERSION" == "8.0" ]; then
export PATH="/d/webstudy/PhpWebStudy-Data/app/php-8.2.18/:$PATH"
else
echo "Please specify a PHP version (e.g., 7.4 or 8.0)"
fi

eg: source switch_php.sh 7.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants