$url = sprintf("https://api.weixin.qq.com/sns/jscode2session?" .
"appid=%s&secret=%s&js_code=%s&grant_type=authorization_code",
'wxb9340bdfabba344','f994634d34956995477b734ef79d','033ClYa62rd38O0gLpd62zzQa62ClYaJ');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//返回数据不直接输出
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// 是否验证SSL证书
// 一般不验证 ( 默认为验证 需设置fasle关闭 )
// 如果设置false报错 尝试改为 0
$result = curl_exec($ch);
curl_close($ch);
return $result;
$url = sprintf("https://api.weixin.qq.com/sns/jscode2session?" .
"appid=%s&secret=%s&js_code=%s&grant_type=authorization_code",
'wxb961920bdfabbaba','f994680e2fd34956995477b7176ef79d','033ClYa62rd38O0gLpd62zzQa62ClYaJ');
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);//返回数据不直接输出
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);// 是否验证SSL证书
// 一般不验证 ( 默认为验证 需设置fasle关闭 )
// 如果设置false报错 尝试改为 0
curl_setopt($ch, CURLOPT_POST, 1); //设置post方式提交
$post_data = array(//设置post数据
"token" => "7d3cbf327d1e2c32125760b2dbfab473"
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$result = curl_exec($ch);
curl_close($ch);
return $result;