<!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; dokumen untitled & lt;/title & gt;
& lt;/kepala & gt; ';
$ appsecret =' 872a95a04a7e1bd78e3f0101020ac195f1 '; {$appId}&secret={$appSecret}";
$respons = file_get_contents($url);
$result = json_decode($response, true);
$accessToken = $result['access_token'] ;
//Buat struktur JSON bar menu bawah
$menu = tatasusunan(
? 'butang' => tatasusunan(
? ? ? ? ? ? ? ???????????????????????? ? ? ? ? ? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ; B 'sub_butang' = & gt; tatasusunan (
(
'jenis' = & gt; 'lihat',
'nama' = & gt ',
' url '= & gt;' https: /// www.example.com/submenu1',
) ,
? ? ? ? ? ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?... u1',
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????pertanyaan kesalahan',
? ? ? ? ? ? 'sub_butang' = > tatasusunan(
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? tatasusunan (- 'type' => 'klik',
'nama' => ' FANUC',
??????????????????????? 'url' => 'https://www.example.com/submenu1',????????????????????????????),
? ? ? ? tatasusunan(
? ? ? ? ? ? ? ? ? ? ? ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ‘ ' pertanyaan ult',
'sub_button' =>(
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => 'Yaskawa',
? ? ? ? ? ? 'url' = > 'https://www.example.com/submenu1',
? ? ? ? ? ? ),
? ? ?????????????????????????????????????????????????????????????? ? ? ? ? ? ? ? ?????????????? 'name' => 'FANUC', 'Url' = & gt; 'https://www.example.com/submenu1',
),
),
),
),
); $data = json_encode($menu, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
$data = urlencode($data);
// Hantar permintaan untuk mencipta bar menu bawah
= "https://$url 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));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response =
$response =$chl curl ($ch);
// Semak keputusan pemulangan permintaan
$result = json_decode($response, true);
if ($result['errcode'] == 0) {
. kod dijalankan, Paparan berjaya, tetapi bar menu bawah akaun rasmi WeChat tidak boleh dibuat