<?php
//处理GET数据$appid="wx0cf1ae434525b3bc";//填写AppID $secret="530d5915c163cce3073062e281a8b21c";//填写Secret$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}";$ch = curl_init();//初始化curl函数curl_setopt($ch,CURLOPT_URL,$url);//GET方式抓取urlcurl_setopt($ch,CURLOPT_RETURNTRANSFER,1);//以文件流的方式输出$a = curl_exec($ch);//将文件保存到变量$a$strjson=json_decode($a);//JSON解析$access_token = $strjson->access_token;//获取access_tokenecho $access_token;?>