Heim >Backend-Entwicklung >PHP-Tutorial >搞过微信公众平台开发的帮帮小弟啊 感谢了解决方法

搞过微信公众平台开发的帮帮小弟啊 感谢了解决方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:48:21876Durchsuche

搞过微信公众平台开发的帮帮小弟啊 感谢了
获取access token

http请求方式: GET
https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET

正常情况下,微信会返回下述JSON数据包给公众号:

{"access_token":"ACCESS_TOKEN","expires_in":7200}


上面是微信公众平台的官网说明文档上获取access_token的部分内容,现在有疑问啊

目前我只知道通过复制上面的的url到地址栏中获取到access_token,如果使用代码的话,该如何操作啊?
我试过两种方式,一是使用file_get_contents,无效,二是使用jquery中的getJSON方法(因为我看接口返回的是json数据),也失败。
所以,凌乱了,这个该怎么获取,如何代码实施?
求助,感谢。


------解决方案--------------------
使用curl把。有个例子 https://github.com/spetacular/weixin/blob/master/weixin.class.php
------解决方案--------------------
应该如楼上说的使用 curl, jquery的话怎么样在服务器端发起呢?你这个是活的他的授权token应该使用申请账号时的服务器来回调吧?还没去做微信公众账号,不过我猜应该是这个样子的。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn