创建微信测试号

 
  
微信测试需要写的php代码
access_token;
$bl='https://api.weixin.qq.com/cgi-bin/menu/create?access_token='.$str;
//echo $bl;die;
$str1='{
    "button": [
        {
            "name": "扫码",
            "sub_button": [
                {
                    "type": "scancode_waitmsg",
                    "name": "扫码带提示",
                    "key": "rselfmenu_0_0",
                    "sub_button": [ ]
                },
                {
                    "type": "scancode_push",
                    "name": "扫码推事件",
                    "key": "rselfmenu_0_1",
                    "sub_button": [ ]
                }
            ]
        }
    ]
}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $bl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// post的变量
curl_setopt($ch, CURLOPT_POSTFIELDS, $str1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,"POST");//3.请求方式
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
// post数据
curl_setopt($ch, CURLOPT_POST, 1);
$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
var_dump($output);


你可能感兴趣的:(wechat,php)