Access_token Acquisition Development example, access_token example
Overview
Access_token is the globally unique ticket of the public account. access_token is required when the Public Account calls each interface. Developers need to properly store them. The storage of access_token must contain at least 512 characters. The validity period of access_token is currently 2 hours. You need to refresh it regularly. Repeated access_token acquisition will invalidate the last access_token.
Access_token acquisition
<? Phpdefine ("APPID", "Your appid"); define ("APPSECRET", "Your appsecret"); $ token_access_url = "https://api.weixin.qq.com/cgi-bin/token? Grant_type = client_credential & appid = ". APPID. "& secret = ". APPSECRET; $ res = file_get_contents ($ token_access_url); // get the file content or obtain the content of the network request // echo $ res; $ result = json_decode ($ res, true ); // accept a JSON string and convert it to the PHP variable $ access_token = $ result ['Access _ token']; echo $ access_token; php>
The above is all the content of this article. I hope you will like it.