更新时间:2022-01-01 01:40:44
指定命令(cmd)的绝对路径.
Specify the absolute path to the command (cmd).
假设 $ file
是/path/to/file
,则命令 ['php',"$ file"]
展开到 php/path/to/file
.就像在命令行上运行以下命令一样:
Let's say $file
is /path/to/file
, then the command ['php', "$file"]
expands to php /path/to/file
. This is like running the following on the command line:
$ php /path/to/file
因为命令( php
)是相对的,所以搜索系统路径(在Linux上,系统路径在环境变量 PATH
中)以找到 php
.
Because the command (php
) is relative, the system path (on linux the system path is in the environment variable PATH
) is searched to find php
.
您可以为命令指定绝对路径.假设您安装了以下版本:
You can specify an absolute path for the command. Let's say you have the following versions installed:
然后,您可以配置命令以使用v7.0.0:
Then you can configure a command to use v7.0.0:
{
"cmd" : ["/path/to/php/versions/7.0.0/bin/php", "$file"],
"file_regex": "php$",
"selector" : "source.php"
}
和v5.5.0:
{
"cmd" : ["/path/to/php/versions/5.5.0/bin/php", "$file"],
"file_regex": "php$",
"selector" : "source.php"
}
依此类推...