PhpStorm 终端结果与 OS 终端结果不同

PhpStorm Terminal result is different with OS terminal result

在 macOS 终端中,当我在特定文件夹中键入 php -v 时,它 returns:

PHP 7.4.12 (cli) (built: Oct 29 2020 18:28:50) ( NTS )

但是当我 运行 在 PhpStorm 终端的同一目录中执行相同的命令时 returns:

PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS )

有人可以帮忙吗?

一些 IDE 附带 compiler/interpreter 本身。

您可以使用他们的 compiler/interpreter 或您的系统 compiler/interpreter。

PhpStorm 附带集成 Php:

https://www.javatpoint.com/phpstorm

有很多这样的 Ide`s like:

jupyter 集成 python

android 集成工作室 java

这个link帮你换解释器php:

https://www.jetbrains.com/help/phpstorm/configuring-local-interpreter.html

看来我们应该使用主 OS 终端打开 PhpStorm,如下命令:

open -a /Applications/PhpStorm.app/

感谢@lazyOne。