PFinal\Wechat\Service\MenuService::all PHP Method

all() public static method

在设置了个性化菜单后,使用本自定义菜单查询接口可以获取默认菜单和全部个性化菜单信息 类型为click、scancode_push、scancode_waitmsg、pic_sysphoto、pic_photo_or_album、 pic_weixin、location_select:保存值到key; 类型为view:保存链接到url
public static all ( ) : array
return array 例如 array( 'menu' => array( 'button' => array( array('type' => 'click', 'name' => '今日歌曲', 'key' => 'V1001_TODAY_MUSIC', 'sub_button' => array()), array('type' => 'click', 'name' => '歌手简介', 'key' => 'V1001_TODAY_SINGER', 'sub_button' => array()), array('name' => '菜单', 'sub_button' => array( array('type' => 'view', 'name' => '搜索', 'url' => 'http://www.soso.com/', 'sub_button' => array(),), array('type' => 'view', 'name' => '视频', 'url' => 'http://v.qq.com/', 'sub_button' => array(),), array('type' => 'click', 'name' => '赞一下我们', 'key' => 'V1001_GOOD', 'sub_button' => array(),),), ) ) ) )
    public static function all()
    {
        $url = 'https://api.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN';
        return parent::request($url);
    }

Usage Example

Exemplo n.º 1
0
Arquivo: mp.php Projeto: pfinal/wechat
    $url = \PFinal\Wechat\Service\QrcodeService::url($result['ticket']);
    echo "<img src='{$url}'>";
    //永久 数字key
    $result = \PFinal\Wechat\Service\QrcodeService::forever(33);
    $url = \PFinal\Wechat\Service\QrcodeService::url($result['ticket']);
    echo "<img src='{$url}'>";
    //永久 字符串key
    $result = \PFinal\Wechat\Service\QrcodeService::forever("haha");
    $url = \PFinal\Wechat\Service\QrcodeService::url($result['ticket']);
    echo "<img src='{$url}'>";
}
if (isset($_GET['template'])) {
    //$data = ['first' => '234', 'keyword1' => 'aaa', 'keyword2' => 'adsfsaf', 'keyword3', 'remark' => 'aaaa'];
    $data = ['first' => ['value' => '234', 'color' => '#FC5C48'], 'keyword1' => 'aaa', 'keyword2' => 'adsfsaf', 'keyword3', 'remark' => 'aaaa'];
    $result = \PFinal\Wechat\Service\MessageService::template($openid3, 'VSmzI2hL3MuHyd1eqw9eIxNsLmY4N8CFTgX4tiCDyYI', $data);
    var_dump($result);
}
if (isset($_GET['menu'])) {
    //var_dump(\PFinal\Wechat\Service\MenuService::create($menus));
    var_dump(\PFinal\Wechat\Service\MenuService::all());
}
//var_dump(\PFinal\Wechat\Service\MessageService::send($openid, new \PFinal\Wechat\Message\Text('pFinal.cn')));
//$result = \PFinal\Wechat\Service\MaterialService::uploadFileTemporary('./test.jpg', 'image');
//var_dump($result);
//var_dump(\PFinal\Wechat\Service\MessageService::send($openid, new \PFinal\Wechat\Message\Image($result['media_id'])));
//var_dump(\PFinal\Wechat\Service\MessageService::send($openid, new \PFinal\Wechat\Message\News($news)));
//var_dump(\PFinal\Wechat\Service\UserService::get($openid));
//var_dump(\PFinal\Wechat\Service\UserService::batchGet([$openid, $openid2]));
//var_dump(\PFinal\Wechat\Service\QrcodeService::temporary(11));
//var_dump(\PFinal\Wechat\Service\QrcodeService::forever(99));
//var_dump(\PFinal\Wechat\Service\QrcodeService::url('gQE08ToAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL05rTzVMYURtYS1zU3pudDVoMi1DAAIEs7oLVwMEAAAAAA=='));