"https://v2.api-m.com/api/heisi", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'GET', )); $response = curl_exec($curl); if(curl_errno($curl)){ echo 'Request Error:' . curl_error($curl); } curl_close($curl); $json = $response; $data = json_decode($json, true); if ($data && isset($data['data']) && filter_var($data['data'], FILTER_VALIDATE_URL)) { $imageUrl = $data['data']; $html = << window.location.href = "$imageUrl"; HTML; echo $html; } else { echo "无法解析数据或数据字段不存在。"; } ?>