<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< ;html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset= utf-8 "/ & gt;
& lt; title & gt; document inédite & lt; / title & gt;
& lt; / head & gt;
& lt ;? php
// remplacer par votre propre appid et app secret
$ appid = 'wxd95fca43ae595a61 ';
$appSecret = '872a95a04a7e1bd78e3f01020ac195f1';
// Obtenir un jeton d'accès
$url = "https://api.weixin.qq.com/c gi-bin/token?grant_type= client_credential& identifiant= {$appId}&secret={$appSecret}";
$response = file_get_contents($url);
$result = json_decode($response, true);
$accessToken = $result['access_token'] ;
// Créer la structure JSON de la barre de menu inférieure
$menu = array(
? 'button' => array(
? ? ? ? ? ?? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ?? ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ?? ? ??? ?? ???? ? ??? ? ? ? ? ? ?????????????????????????????????& gt; tableau (
tableau (
'type' = & gt; 'view',
'name' = & gt; ',
' url '= & gt;' ,??? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? ???? ??????? ? ????????????????? ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? mais mais ? ? 'https://www.example.com/submenu1',
?????;?????????????????????????????????????????????????????????????????????????????????????????????????t; bouton' = > array(
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? array(- 'type' => 'cliquez',
'nom' => 'FANUC',????????????????????? 'url' => 'https://www.example.com/submenu1',??????????????),??),
? ? ? ? array(
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? en utilisant ? en utilisant en utilisant ? ? ?? ? ? ? ? ? ‐ out off off ‐ ‐ ‐ ‐ ‐ ‐ array(
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? à 'F ; ault query',
'sub_button' => array(
? ? ? ? ? ? ?? ? ? ?? ? ? ? ? ? ? ?'name' => 'Yaskawa',
? ? ? ? ? ? 'url' = > 'https://www.example.com/submenu1',
? ? ? ? ? ? ),
? ? ? ? ? ? array(
? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ?????????????? 'nom' => 'FANUC', 'Url' = & gt; 'https://www.example.com/submenu1',
),
),
),
),
); $data = json_encode($menu, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$data = urlencode($data);
// Envoyer une demande pour créer la barre de menu inférieure $url = "https:// api.weixin.qq.com/cgi-bin/menu/create?access_token={$accessToken}";$ch = curl_init();curl_setopt($ch, CURLOPT_URL, $url);curl_setopt( $ch, CURLOPT_POST, 1);curl_setopt ($ch, CURLOPT_POSTFIELDS, urldecode ($ data)); ($ch);echo 'Création de la barre de menu inférieure réussie';
} else {
echo 'échec de la création de la barre de menu inférieure :' . le code est exécuté, l'affichage est réussi, mais la barre de menu inférieure du compte officiel WeChat ne peut pas être créée