| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\index\controller;
- require_once('function.php');
- use think\Controller;
- use \app\index\controller\Common;
- class Create extends Common
- {
- //创建菜单项
- public function creatMenu()
- {
- //组装请求的url地址
- $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".$this->accessToken;
- $data = array(
- // button下的每一个元素
- "button"=>array(
- //第一个一级菜单
- array(
- "name"=>"报修管理",
- "sub_button"=>array(
- array("name"=>'我要报修',"type"=>"view",
- 'url'=>"http://ceshi.kamihu.com/index/index/repairs"),
- array('name'=>'报修记录',"type"=>"view",
- 'url'=>"http://ceshi.kamihu.com/index/index/repairsList"),
- )
- ),
- array(
- "name"=>"维修管理",
- "sub_button"=>array(
- array("name"=>'维修记录',"type"=>"view",
- 'url'=>"http://ceshi.kamihu.com/index/index/polist")
- )
- ),
- array(
- "name"=>"个人中心",
- "sub_button"=>array(
- array("name"=>'个人信息',"type"=>"view",
- 'url'=>"http://ceshi.kamihu.com/index/index/myinfo"),
- array('name'=>'个人注册',"type"=>"view",
- 'url'=>"http://ceshi.kamihu.com/index/index/register"),
- array('name'=>'分享注册',"type"=>"view",
- 'url'=>"http://ceshi.kamihu.com/index/index/sharepage")
- )
- )
- )
- );
- // 将数据转换为json格式
- $data = json_encode($data,JSON_UNESCAPED_UNICODE);
- $result = http_curl($url,$data,'post');
- dump($result);
- }
- }
|