Because WeChat can now open custom menus, many people don’t know how to create custom menus. Today I will share how to create a custom menu! Let’s look at the code directly:
"; var_dump(post($url, $jsonData)); function post($url, $jsonData){ $ch = curl_init($url) ; curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS,$jsonData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $result = curl_exec($ch) ; curl_close($ch) ; return $result; }
After successful operation,
{"errcode":0,"errmsg":"ok"}
will appear. I’ll share this with you now! Such as querying custom menus, deleting, etc., these can be realized according to the WeChat API!
The above is the detailed content of WeChat development tutorial series (3). For more information, please follow other related articles on the PHP Chinese website!