您好,欢迎访问一九零五行业门户网

微信 php 自定义菜单,该如何解决

微信 php 自定义菜单
我申请了一个微信公众平台的测试账号,之前已经通过验证,关注后用我的微信号向测试账号发消息可以得到测试账号的正确响应,我现在想实现微信的自定义菜单,下面用***代替了我测试账号的appid和secret,我进测试账号没看到自定义菜单,请问问题出在哪?
post($wechatobj->get_access_token(), $data);
class wechatcallbackapitest
{
public function get_access_token(){
$json=http_request_json($token_url);
$data=json_decode($json,true);
if($data['access_token']){
return $data['access_token'];
}else{
return 获取access_token错误;
}
}
public function http_request_json($url){
$ch = curl_init();
curl_setopt($ch, curlopt_url,$url);
curl_setopt($ch, curlopt_ssl_verifypeer, false);
curl_setopt($ch, curlopt_ssl_verifyhost, false);
curl_setopt($ch, curlopt_returntransfer, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
public function post($access_token, $jsondata){
$ch = curl_init(https://api.weixin.qq.com/cgi-bin/menu/create?access_token=.$access_token) ;
curl_setopt($ch, curlopt_post, 1);
curl_setopt($ch, curlopt_customrequest, post);
curl_setopt($ch, curlopt_postfields,$jsondata);
curl_setopt($ch, curlopt_returntransfer, true);
curl_setopt($ch, curlopt_httpheader, array('content-type: application/json'));
$result = curl_exec($ch) ;
curl_close($ch) ;
return $result;
}
}
?>

分享到: 更多
其它类似信息

推荐信息