在 Sublime 中运行 PHP 代码有两种主要方法:通过终端运行:打开终端窗口,导航到 PHP 文件位置,使用 php 命令运行文件。安装插件运行:安装 PHP 插件,配置插件,选择“PHP - Command Line”构建系统即可运行代码。
在 Sublime 中运行 PHP 代码
对于在 Sublime Text 编辑器中运行 PHP 代码,有两种主要方法:
通过终端
cd
命令导航到存储 PHP 文件的目录。运行 PHP 文件:使用以下命令运行 PHP 文件:
php <文件名称>.php
通过插件
详细步骤
通过终端运行
导航到 PHP 文件的目录。例如,如果文件位于 Documents/php
文件夹中,请输入以下命令:
cd Documents/php
运行 PHP 文件。例如,要运行名为 test.php
的文件,请输入:
php test.php
通过插件运行
提示
The above is the detailed content of How to run code php in sublime. For more information, please follow other related articles on the PHP Chinese website!