WeChat Public platform Development (iii) subscription events (subscribe) Processing _php Tutorials

Source: Internet
Author: User
Tags cdata sprintf
< span="">

New users focus on the public platform and will generate a subscription event, the subscribe event , which does not respond appropriately to this event in the default code.

After the new user has focused on the public platform, it may be interesting to know what features the platform provides and how to use it, which is a "user's manual" for the platform.

This article will detail the processing of the Subscribe event, and respond to the corresponding information to promote interactivity.

< span="">

Currently, there are five types of messages available, namely:

    • Text Message (textbox);
    • Image message (image);
    • Geolocation information (location);
    • Linked message (link);
    • Event push (events);

When you receive a message, you first need to make a judgment on the message type, and then make the processing for different types of messages. In the event push, the event type is divided into three kinds,subscribe (subscription), unsubscribe (unsubscribe), click (Custom menu click event), but also need to add another judgment, after judging the subscribe event, according to set the welcome message, Reply to the user.

< span="">

 =  (, ' simplexmlelement ' ,  =  (->  (
             
               "text":  = ->handletext (
                  
                   
                     
                      "event":  = ->handleevent (
                           
                            :  = "Unknow msg type:". 
                               
                                
                                  
                                  
                                  
                               
                    
                  
              

Description

$RX _type = Trim ($postObj->msgtype); Get the message type;

Case "Text":
$RESULTSTR = $this->handletext ($POSTOBJ); Use the Handletext () function to process text messages;

Case "Event":
$RESULTSTR = $this->handleevent ($POSTOBJ); Use the Handleevent () function to handle event pushes;

< span="">

< span="">< span="">("< span="">  Subscribe"):  < span="">            = "Thank you for your interest in" Zhuo Jin Suzhou " < span=""> ." \ n "." Number: Zhuojinsz "." \ n "." Excellent splendid, famous city of Suzhou, we provide you with Suzhou Local life guide, Suzhou Related information query, do the best Suzhou platform. "." \ n "." The current platform features are as follows: "." \ n "." "1" Check the weather, such as enter: Suzhou Weather "." \ n "." "2" Check bus, such as input: Suzhou bus 178 "." \ n "." "3" translation, such as input: translation I love You "." \ n "." "4" Suzhou information query, such as input: Suzhou Guan Qian Street. \ n "." For more information, please look forward to ...  < span="">  < span="">  < span="">  < span=""> "  = "Unknow Event:". < span="">  < span=""> -< span="">< span="">< span="">

Description

If it is Subscribe event, set the reply content as "Thank you for your attention" Zhuo Jin Suzhou "...";

< span="">

  ("TOKEN", "Zhuojin"=-valid ();checksignature ()) {echo $echoStr; exit;} }   =["Http_raw_post_data" (!(=(, ' SimpleXMLElement ',=(-("Text":=->handletext ("Event":=->handleevent (:= "Unknow msg type:". "" Handletext (=-=-=(-== "
                                                                                             
                                                                                             %s 
                                                                                              
                                                                                             %s 
                                                                                              
                                                                                             
                                                                                              %s
                                                                                              
                                                                                             
                                                                                              0 %s 
                                                                                              
                                                                                              %s 
                                                                                              
                                                                                              
                                                                                            "(!(= "Text"= "Welcome to WeChat world!"=(,,,,, "Input something ..." Handleevent (= ""(-"Subscribe":= "Thank you for your interest in" Zhuo Jin Suzhou "." \ n "." Number: Zhuojinsz "." \ n "." Excellent splendid, famous city of Suzhou, we provide you with Suzhou Local life guide, Suzhou Related information query, do the best Suzhou platform. "." \ n "." The current platform features are as follows: "." \ n "." "1" Check the weather, such as enter: Suzhou Weather "." \ n "." "2" Check bus, such as input: Suzhou bus 178 "." \ n "." "3" translation, such as input: translation I love You "." \ n "." "4" Suzhou information query, such as input: Suzhou Guan Qian Street. \ n "." For more information, please look forward to ... ":= "Unknow Event:".-=->responsetext (</xml>,  ResponseText (,,=0= " 
                                                                                                                                                         
                                                                                                                                                          
                                                                                                                                                          %s%d 
                                                                                                                                                          %s 
                                                                                                                                                          
                                                                                                                                                          %s 
                                                                                                                                                          
                                                                                                                                                          text 
                                                                                                                                                          
                                                                                                                                                          %s 
                                                                                                                                                          
                                                                                                                                                        "=(,->fromusername,->tousername,(),,  =["Signature"=["Timestamp"=["Nonce"==(,,(=(=((==</xml>  < span="">?>

< span="">

Please pay attention to Zhuo Kam Suzhou public account, Zhuo Kam Suzhou based on the development of SAE platform, for the mainstream function of the development test.

You can take a look at the Suzhou public account to perform functional testing and get new application development.

1. Login client, friends, add friends--Search number---Zhuojinsz, find and follow.

2. Scan QR Code:

Zhuo Jin Suzhou feature List.

< strong="">

    • < li="">

    < p="">

    < p="">

      • < li="">
      • < li="">
      • < li="">

      < strong="">We believe, great people Share knowledge ...

      http://www.bkjia.com/PHPjc/440365.html www.bkjia.com true http://www.bkjia.com/PHPjc/440365.html techarticle new users focus on the public platform and will generate a subscription event, the Subscribe event, which does not respond appropriately to this event in the default code. Focus on the public platform for new users ...

    • Related Article

      Contact Us

      The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

      If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

      A Free Trial That Lets You Build Big!

      Start building with 50+ products and up to 12 months usage for Elastic Compute Service

      • Sales Support

        1 on 1 presale consultation

      • After-Sales Support

        24/7 Technical Support 6 Free Tickets per Quarter Faster Response

      • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.