写一个php代码接收第三方推送的component_verify_ticket然后获取component_access_token并显示出来
时间: 2023-03-15 09:19:22 浏览: 130
微信开放平台-获取授权事件接收URL的component_verify_ticket php版本 版本太老了 不建议下载
3星 · 编辑精心推荐
<?php$component_verify_ticket = $_POST['component_verify_ticket'];$url = "https://api.weixin.qq.com/cgi-bin/component/api_component_token";$data = array(
'component_appid' => 'xxxxx',
'component_appsecret' => 'xxxxx',
'component_verify_ticket' => $component_verify_ticket,
);
$data = json_encode($data);$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$output = curl_exec($ch);
curl_close($ch);$output = json_decode($output, true);
$component_access_token = $output['component_access_token'];echo $component_access_token;?>
阅读全文