以下是使用PHP获取并解析JSON,并将其中的图片显示在网页上,同时添加一个按钮跳转到JSON中的ID对应的页面的代码:

<?php
// 获取JSON数据
$json = file_get_contents('http://38.60.51.98:8585/search?k=00%E5%90%8E');

// 解析JSON数据
$data = json_decode($json, true);

// 输出每个结果的图片
foreach ($data as $result) {
    echo '<img src="' . $result['img'] . '"><br>';
    
    // 添加按钮跳转到对应ID的页面
    echo '<button onclick="window.location.href=\'http://38.60.51.98:8585/get?id=' . $result['id'] . '\'">跳转到该页面</button><br><br>';
}
?>
获取http386051988585searchk=00E5908E的json并解析出来将img显示在网页上写一个按钮按钮跳转为json里的id跳转到http386051988585getid=帮我用php写出来

原文地址: https://www.cveoy.top/t/topic/N7v 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录