Home  >  Article  >  php教程  >  微信通过数据库创建菜单

微信通过数据库创建菜单

PHP中文网
PHP中文网Original
2016-05-25 16:58:08847browse

1. [文件]     menuCreate.php 

";
//echo $data;
///echo "
"; $MENU_URL= "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$ACC_TOKEN; $ch = curl_init($MENU_URL); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length:'.strlen($data))); $info = curl_exec($ch); //创建成功返回:{"errcode":0,"errmsg":"ok"} $menu = json_decode($info); var_dump($menu); /* if($menu->errmsg == "ok"){ echo "菜单创建成功"; }else{ echo "菜单创建失败"; } */ ?>

                               

                   

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn