<?php
$appid="wx1";
$appsecret="";
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$arr=curl_exec($ch);
$arrs=json_decode($arr,TRUE);
$access_token=$arrs['access_token'];
curl_close($ch);
$url=" https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$access_token}";
//echo $url;
$data=' {
"button":[
{
"type":"click",
"name":"今日歌曲",
"key":"V1001_TODAY_MUSIC"
},
{
"name":"菜单",
"sub_button":[
{
"type":"view",
"name":"搜索",
"url":"http://www.soso.com/"
},
{
"type":"miniprogram",
"name":"wxa",
"url":"http://mp.weixin.qq.com",
"appid":"wx286b93c14bbf93aa",
"pagepath":"pages/lunar/index.html",
},
{
"type":"click",
"name":"赞一下我们",
"key":"V1001_GOOD"
}]
}]
}';
//开启curl
$ch=curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
//以post方式请求
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
//发送CURL
$arr1=curl_exec($ch);
//将文件转化为数组
$arrs1=json_decode($arr1,TRUE);
//$postJson = urldecode( json_encode($postArr)
var_dump($arrs1);
//echo $arr;
//关闭资源
curl_close($ch);
?>
代码这样写的 但SAE总是报 array(2) { ["errcode"]=> int(85005) ["errmsg"]=> string(43) "appid not bind weapp hint: [8B7MCA0377vr23]" }