1. 云栖社区>
  2. PHP教程>
  3. 正文

微信菜单数组格式

作者:用户 来源:互联网 时间:2017-12-01 19:11:18

数组菜单格式

微信菜单数组格式 - 摘要: 本文讲的是微信菜单数组格式,<?php // 一级菜单 $array = array( "button"=> array( array( "type"=>"click","name"=>urlencode("最新咨询"),"

<?php
// 一级菜单
$array = array(
"button"=>
array(
array(
"type"=>"click",
"name"=>urlencode("最新咨询"),
"key"=>"db"
),
array(
"name"=>urlencode("查询"),
"sub_button"=>
array(
array(
"type"=>"click",
"name"=>urlencode("绑定"),
"key"=>"a"
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
)
)
),
array(
"name"=>urlencode("查询"),
"sub_button"=>
array(
array(
"type"=>"click",
"name"=>urlencode("绑定"),
"key"=>"b"
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
)
)
)
)
);
$json = urldecode(json_encode($array));
/*全部二级菜单*/
$array = array(
"button"=>
array(array(
"name"=>urlencode("查询"),
"sub_button"=>
array(
array(
"type"=>"click",
"name"=>urlencode("绑定"),
"key"=>"a"
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
)
)
),
array(
"name"=>urlencode("查询"),
"sub_button"=>
array(
array(
"type"=>"click",
"name"=>urlencode("绑定"),
"key"=>"b"
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
)
)
),
array(
"name"=>urlencode("查询"),
"sub_button"=>
array(
array(
"type"=>"click",
"name"=>urlencode("绑定"),
"key"=>"b"
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
),
array(
"type"=>"view",
"name"=>urlencode("跳转URL"),
"url"=>urlencode("http://www.example.com/")
)
)
)
)
);
?>

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索数组 , 菜单 格式 ,以便于您获取更多的相关知识。