易信公众帐号添加自定义菜单

首先我们设置菜单的内容

$data = array(
			"button"=>array(
				array(
					"name"=>"点击测试",
					"sub_button"=>array(
						array(
						"name"=>"点击1",	
						"type"=>"click",
						"key"=>"http://www.baidu.com",
						),
						array(
						"name"=>"点击2",	
						"type"=>"click",
						"key"=>"http://www.taobao.com",	
						)
					),
				),
				array(
				"name"=>"查看测试",
				"type"=>"view",
				"key"=>"help.php",
				),
				array(
				"name"=>"查看yx",
				"type"=>"view",
				"key"=>",help.yx",
				)
			)
		);

然后

$url = "https://api.yixin.im/cgi-bin/menu/create?access_token=".$access_token;
$jsondata = json_encode($data);

$access_token为你的access_token
然后将$data的数据POST到$url就行了,根据返回码查看操作是否成功

发表评论

电子邮件地址不会被公开。 必填项已用*标注