PHP微信公眾平台自定義選單

2021-06-22 00:23:20 字數 1022 閱讀 5340

請求說明

http請求方式: get

現在你的token已經獲取成功了,下來就是相關的**實現了。

public function createmenu(),,,

,]}]}';

$ch = curl_init();

curl_setopt($ch, curlopt_url, "");

curl_setopt($ch, curlopt_customrequest, "post");

curl_setopt($ch, curlopt_ssl_verifypeer, false);

curl_setopt($ch, curlopt_ssl_verifyhost, false);

curl_setopt($ch, curlopt_useragent, 'mozilla/5.0 (compatible; msie 5.01; windows nt 5.0)');

curl_setopt($ch, curlopt_followlocation, 1);

curl_setopt($ch, curlopt_autoreferer, 1);

curl_setopt($ch, curlopt_postfields, $data);

curl_setopt($ch, curlopt_returntransfer, true);

$tmpinfo = curl_exec($ch);

if (curl_errno($ch))

curl_close($ch);

var_dump($tmpinfo);

}現在和合適的位置呼叫上面的方法就可以實現選單了,

<?php

include_once('include/weixin.class.php');

define('token', 'ubive');

define('debug', false);

$weixin->createmenu();

?>

www.51mubanji.com

) 詳細出處參考:

微信公眾平台自定義選單

介面呼叫請求說明 http請求方式 get引數說明 引數是否必須 說明grant type 是獲取access token填寫client credential 是第三方使用者唯一憑證 secret 是返回說明 引數 說明access token 獲取到的憑證 expires in 憑證有效時間,單...

微信公眾平台 自定義選單

服務號和通過認證的訂閱號可以申請自定義選單。自定義選單介面可實現click view兩種型別的按鈕。1 建立選單 const createmenuurl function createmenus accesstoken string tjsonobject var url string j tjso...

微信公眾平台04 自定義選單

首先自定義選單需要獲取access token,由於access token有效時間僅為兩個小時,因此,我們需要將其封裝成函式,為今後的開發省去麻煩。class wxcommonelse 這個函式寫在wei.class.php檔案裡。接下來是自定義選單檔案 require weixin.class....