Access_token acquisition development example, access_token example. 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. Developer needs access_token to obtain the 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.
Token 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...