Beispiel #1
0
    } elseif ($weixin->msg['Content'] == '单条图文') {
        //如有必要可以为此条信息标星
        //$weixin->setFlag = true;
        $news['items'] = array(array('title' => '微信 公众平台消息接口 SDK', 'description' => '这是图文消息内容,仅在单条图文的时候会显示', 'picurl' => $strURL . '/sdk.jpg', 'url' => 'http://www.xhxu.cn'));
        $reply = $weixin->makeNews($news);
    } elseif ($weixin->msg['Content'] == '多条图文') {
        //如有必要可以为此条信息标星
        //$weixin->setFlag = true;
        //图文内容条数最大10(多余10条将自动丢弃)
        $news['items'] = array(array('title' => '微信 公众平台消息接口 SDK (标题1)', 'description' => '微信 公众平台消息接口SDK 说明1 (多条图文时,不会显示)', 'picurl' => $strURL . '/sdk.jpg', 'url' => 'http://www.xhxu.cn'), array('title' => '微信 公众平台消息接口 SDK (标题2)', 'description' => '微信 公众平台消息接口SDK 说明2 (多条图文时,不会显示)', 'picurl' => $strURL . '/sdk.jpg', 'url' => 'http://www.xhxu.cn'), array('title' => '微信 公众平台消息接口 SDK (标题3)', 'description' => '微信 公众平台消息接口 SDK 说明3 (多条图文时,不会显示)', 'picurl' => $strURL . '/sdk.jpg', 'url' => 'http://www.xhxu.cn'));
        $reply = $weixin->makeNews($news);
    } else {
        $note = '你好,你发的信息是:' . $weixin->msg['Content'];
        $reply = $weixin->makeText($note);
    }
} elseif ($type === 'location') {
    //用户发送位置信息
    $note = '您的位置在: ' . $weixin->msg['Label'] . '坐标是: X:' . $weixin->msg['Location_X'] . ' Y:' . $weixin->msg['Location_Y'];
    $reply = $weixin->makeText($note);
} elseif ($type === 'image') {
    //用户发送图片消息
    $note = '你发送的图片地址是: ' . $weixin->msg['PicUrl'];
    $reply = $weixin->makeText($note);
} elseif ($type === 'voice') {
    //用户发送语音信息
    $note = '你发送了一条语音信息.';
    $reply = $weixin->makeText($note);
}
//输出
$weixin->reply($reply);