# 示例 (1) 简单示例 * 使用lambda特性 ```cpp static HttpClient http; http.post("https://example.com") .header("content-type", "application/json") .queryParam("key", "Hello world!") .body(R"({"user": "test"})") .onResponse([](QByteArray result) { /* 接收数据 */ qDebug() << "Result: " << result; }) .onResponse([](qint64 recv, qint64 total) { /* 接收进度 */ qDebug() << "Total: " << total << "; Received: " << recv; }) .onError([](QString errorStr) { /* 错误处理 */ qDebug()<<"Error: "< infos; if (!result.isEmpty()) data = result.value("data").toMap(); if (!data.isEmpty()) infos = data.value("info").toList(); static HttpService http; foreach (QVariant each, infos) { http.get("http://m.kugou.com/app/i/getSongInfo.php") .queryParam("cmd", "playInfo") .queryParam("hash", each.toMap()["hash"]) .onResopnse([](QVariantMap result){ qDebug()<<"mp3: "< 微信公众号:Qt君

Qt君