Menu.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: admin
  5. * Date: 2019/10/18
  6. * Time: 15:14
  7. */
  8. namespace wx\offiaccount;
  9. use wx\Base;
  10. class Menu extends Base
  11. {
  12. /**
  13. * 创建菜单
  14. * @param $token
  15. * @param $menu
  16. * @return mixed|null
  17. */
  18. public function crete($token, $menu)
  19. {
  20. $url = 'https://api.weixin.qq.com/cgi-bin/menu/create?access_token=' . $token;
  21. $data = $this->curl($url, $menu);
  22. return $data;
  23. }
  24. /**
  25. * 查询菜单
  26. * @param $token
  27. * @return mixed|null
  28. */
  29. public function getMenu($token)
  30. {
  31. $url = 'https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=' . $token;
  32. $data = $this->curl($url);
  33. return $data;
  34. }
  35. /**
  36. * 删除菜单接口
  37. * @param $token
  38. * @return mixed|null
  39. */
  40. public function delMenu($token)
  41. {
  42. $url = 'https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=' . $token;
  43. $data = $this->curl($url);
  44. return $data;
  45. }
  46. }