$value) { $fullKey = $prefix === '' ? $key : "{$prefix}_{$key}"; if (is_array($value)) { $result += self::Json2Arr($value, $fullKey); } else { $result[$fullKey] = $value; } } return $result; } public static function CurlGet(string $url): array { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); // 设定请求网址 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // 回传结果而不是直接输出 $response = curl_exec($ch); // 执行请求 $err = curl_error($ch); // 错误信息 curl_close($ch); // 关闭连接 if ($err) { return ['ok' => false, 'error' => $err]; } return json_decode($response, true); } }