Как разработать пользовательское меню на wechat

Вот мой пример кода. мой режим разработчика уже включен, но нет вкладок меню опций.

Вы также можете добавить меня на wechat, чтобы я мог уточнить мои проблемы в этом вопросе, вот мой идентификатор wechat VinceZen. Мне очень нужна помощь, ребята. Заранее спасибо.

<?php$data[] = '772134292672v';
$data[] = $_GET['timestamp'];
$data[] = $_GET['nonce'];asort($data);

$strData = '';
$d = '';
$authString = '';
foreach($data as $d)
{
$authString .= $d;

}

//verify the signature
if(sha1($authString) == $_GET['signature'])
{
//check the echostr
if(!empty($_GET['echostr']))
{
echo $_GET['echostr'];
die();
}
else
{

//logic

//Getting access_token from customize menus
static function get_access_token($appid,$secret){
$url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret;
$json=http_request_json($url);//here cannot use file_get_contents
$data=json_decode($json,true);
if($data['access_token']){
return $data['access_token'];
}else{
return "Error occurred while geting the access_token";
}
}
//Though URL request is https',cannot use file_get_contents.Using CURL while asking the JSON data
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;
}$return = "<xml>
<ToUserName><![CDATA['.$toUser.']]</ToUserName>
<FromUserName><![CDATA['.$fromUser.']]</FromUserName>
<CreateTime>'.time.'</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA['.text.']]</Content>
<FuncFlag>0</FuncFlag>
</xml>";
echo $return;
{

"button":[
{
"type":"click",
"name":"Daily Song",
"key":"V1001_TODAY_MUSIC"},
{
"type":"click",
"name":" Artist Profile",
"key":"V1001_TODAY_SINGER"},
{
"name":"Menu",
"sub_button":[
{
"type":"view",
"name":"Search",
"url":"http://www.soso.com/"},
{
"type":"view",
"name":"Video",
"url":"http://v.qq.com/"},
{
"type":"click",
"name":"Like us",
"key":"V1001_GOOD"}]
}]
}

}
}
else

{
die('Access Denied');
}`enter code here`

?>

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector