Home > Backend Development > PHP Tutorial > 微信获取获取access_token失败

微信获取获取access_token失败

WBOY
Release: 2016-06-06 20:38:35
Original
2103 people have browsed it

写了一个获取access_token的php代码,在服务器中用命令直接运行这个php文件,可以获得access_token的值,但是在浏览器中运行这个php文件,返回的却是false。换了另外一种方式写,用Java代码获取access_token,却是可以的,既能在服务器中运行获得又可以在浏览器中获得微信获取获取access_token失败

回复内容:

写了一个获取access_token的php代码,在服务器中用命令直接运行这个php文件,可以获得access_token的值,但是在浏览器中运行这个php文件,返回的却是false。换了另外一种方式写,用Java代码获取access_token,却是可以的,既能在服务器中运行获得又可以在浏览器中获得微信获取获取access_token失败

https://github.com/thenbsp/Wechat

<code>use Thenbsp\Wechat\Wechat;

$o = new Wechat(APPID, APPSECRET);

var_dump('AccessToken: '.$o->getAccessToken());
</code>
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template