北风网视频菜单3

运行Test.java得到的access_token和expires_in

https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx07ddcdcbaa0333d2&secret=c7bae79dc3c5c7abeb89d86c5ca405c4
{"access_token":"aCmfSM62af7uDnrklH2P51FZ67fUNK-jK3LBFbcihNzJof9zezW89f89n9ofnaqxmfg3myOGH6OyYQuwX6taBttd0oIg7sgBZxxxmVF17zNEiPSo2fkQx71JoMh5k0UZZIMaAHAVEI","expires_in":7200}

 需要把字符串转化成我们需要的这个对象

connection.setDoOutput()

Sets the value of the doOutput field for this URLConnection to the specified value.

A URL connection can be used for input and/or output. Set the DoOutput flag to true if you intend to use the URL connection for output, false if not. The default is false.

Parameters:
dooutput the new value.
Throws:
IllegalStateException - if already connected
See Also:
getDoOutput()
这个方法的参数值默认是false,将它设置为true
原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/6308771.html