Home > Backend Development > PHP Tutorial > After scanning the QR code on WeChat, the user will automatically follow the public account and receive notifications on the front page. How to achieve this?

After scanning the QR code on WeChat, the user will automatically follow the public account and receive notifications on the front page. How to achieve this?

WBOY
Release: 2016-10-11 14:23:49
Original
2996 people have browsed it

For example, this website
corn.net

Reply content:

For example, this website
corn.net

<code>    /**
     * @descrpition 关注
     * @param $request
     * @return array
     */
    public static function eventSubscribe(&$request){
        $content = '欢迎您关注我们的微信,将为您竭诚服务';
        return ResponsePassive::text($request['fromusername'], $request['tousername'], $content);
    }

    /**
     * @descrpition 取消关注
     * @param $request
     * @return array
     */
    public static function eventUnsubscribe(&$request){
        $content = '为什么不理我了?';
        return ResponsePassive::text($request['fromusername'], $request['tousername'], $content);
    }

    /**
     * @descrpition 扫描二维码关注(未关注时)
     * @param $request
     * @return array
     */
    public static function eventQrsceneSubscribe(&$request){
        $content = '欢迎您关注我们的微信,将为您竭诚服务';
        return ResponsePassive::text($request['fromusername'], $request['tousername'], $content);
    }

    /**
     * @descrpition 扫描二维码(已关注时)
     * @param $request
     * @return array
     */
    public static function eventScan(&$request){
        $content = '您已经关注了哦~';
        return ResponsePassive::text($request['fromusername'], $request['tousername'], $content);
    }</code>
Copy after login

Backend display

<code> $show=('终于等到您!');
              $name=$_SESSION['wxapp']['nickname'];//微信昵称
              $tousername = $_SESSION['wxapp']['openid'];//微信openid
             echo $show.$name.$tousername;</code>
Copy after login

I implemented it using LaneWeChat,

https://segmentfault.com/q/10...

There is no automatic follow, it just jumps to the official account details and then there is a follow button.
Also, I can’t log in.

I read the question wrong. Just use WeChat to access your needs
https://open.weixin.qq.com/cg...

I can’t understand some of the answers above! I searched on Baidu and this is the only result for now.
http://ms.csdn.net/geek/51618
Normally speaking, what comes out after scanning is the confirmation button interface, not the page to follow.
Maybe it can be set in the background. This is the first time I know there is such a powerful function.

Practice is science. After scanning this website, users must pay attention manually. .

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template