vscode中文版插件

在这里插入图片描述

vscode运行php代码

1.插件安装

在这里插入图片描述

2.配置项

左上角文件——首选项——设置——输入php.validate.executablePath

在这里插入图片描述

在这里插入图片描述

{
    "workbench.colorTheme": "Default Dark Modern",
        "php.validate.executablePath": "E:/phpstudy/php.exe",
        "php.debug.executablePath": "E:/phpstudy/php.exe",
        "phpserver.phpConfigPath": "E:/phpstudy/php.ini",
        "phpserver.phpPath": "E:/phpstudy/php.exe"
}
3.尝试运行

在这里插入图片描述
代码:

<?php
$data = '{
    "hbt": "0",
    "hbt2": "2",
    "hbt3": "3"
}';

// 将JSON字符串转换为关联数组
$array = json_decode($data, true);

// 遍历数组并筛选出值不为0的对象
$result = array();
foreach ($array as $key => $value) {
    if ($value != "0") {
        $result[$key] = $value;
    }
}

// 输出结果
foreach ($result as $key => $value) {
    echo $key . ": " . $value . "\n";
}

在这里插入图片描述这样代表运行成功

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐