String url="https://api.weixin.qq.com/wxa/business/getuserphonenumber?scope=snsapi_userinfo&access_token=ACCESS_TOKEN&code=CODE";
url = url.replace("ACCESS_TOKEN", token).replace("CODE", code);
String postResult = HttpUtil.post(url, "{}");
{"errcode":40029,"errmsg":"invalid code hint: [XfmcTVNre-vGNNia] rid: 628da727-52e5b3c7-79315d09"}

请参考示例
https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/phonenumber/phonenumber.getPhoneNumber.html
code 以 JSON 字符串格式写在 POST 请求的 body 中
非常感谢,你说的是对的,入参要传json字符串,谢谢。我把改后的代码也发一下,希望能帮助到其他人,,,,,String url="https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token="+token;String jsonStr="{\"code\":\""+code+"\"}";String postResult = HttpUtil.post(url, jsonStr);这个接口要传入code参数的。可通过前端bindgetphonenumber获得
https://developers.weixin.qq.com/miniprogram/dev/component/button.html