誰かがエラーを確認するのを手伝ってくれますか?
P粉524549047
P粉524549047 2023-12-14 09:52:50
0
0
237

<!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" />

<title>無題ドキュメント</title>

</head>

<?php

// 独自の AppID と AppSecret に置き換えます。

$appId = 'wxd95fca43ae595a61';

$appSecret = '872a95a04a7e1bd78e3f01020ac195f1 ';


#// アクセス トークンの取得

$url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid ={$appId}&secret={$appSecret}";

$response = file_get_contents($url);

$result = json_decode($response, true);

$accessToken = $result['access_token'];


// 下部メニューバーの JSON 構造を作成します

$menu = array(

'button' =&gt; array(

'sub_button' =&gt; array(

Array(

」 s out out out out out out out out out out of it . ' url' => 'https://www.example.com/submenu1',

),

array(

'type' => 'click' ,

'name' = & gt ;'faa,

'Url' = & gt; #to 'sub_button' =&gt; array(

# with stuel 's - - ‐ ‐ ‐ ‐ ‐ ‐ `away

#' url '=&gt;' https://www.example .com/subsenu1',

##),

Array (

' Type '= > 'click',

'name' => 'ファナック、

'url' => 'https://www.example.com/submenu1',

Array(

' name '=&gt;' Fail Query '' ,

'サブボタン' = & GT 'タイプ' => 'ビュー',

'名前' => '安川',

'url' => ; 'https://www.example.com/submenu1 ',

array(

',

' URL '= & gt ;' https://www.example.com/submenu1',

##),

##),

),

),

);

// メニュー構造を JSON 文字列に変換し、URL エンコードを行います

$data = json_encode($menu, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);

$data = urlencode($data);

// リクエストの送信 下部のメニュー バーの作成


$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));

curl_setopt($ ch, CURLOPT_RETURNTRANSFER, true);

$response =curl_exec($ch);

curl_close($ch) ;

/ / リクエストの戻り結果を確認します。

$result = json_decode($response, true);

if ($result[ 'errcode'] == 0) {

echo '下部メニュー バーの作成に成功しました';

} else {

echo '下部メニュー バーの作成に失敗しました:' . $ result['errmsg'];

}

?>

上記のコードを実行すると正常に表示されますが、WeChat公式アカウントの下部メニューバーが作成できません

P粉524549047
P粉524549047

全員に返信(0)
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!