Micro-Signal debugging problems

Source: Internet
Author: User
The Reply keyword server receives the logic here how to output?? Let's say I received the XML data and then output, but sometimes I need to write the array and output what to do.

If you write to a file and the database table can only output XML and the string cannot output an array


Reply to discussion (solution)

Tried to, I put the key word reply conditions are written in the code dead. Not in the database.

 fromusername; $toUsername = $postObj->tousername; $keyword = Trim ($postObj->content); $key = $Msg->match ($rule , $keyword), #循环开始, determine the message sent by the user, the parameters in the following method introduction switch ($key) {case "guessing": $Msg->picmsg ($fromUsername, $toUsername, " Co-create Ying Feng on-line ceremony: free guessing four digits, in the phone 300 yuan! "," http://www.hcyf07.com/weixin/sdd2.jpg ", ' Quiz '," http://www.hcyf07.com "); exit (); case" Guess call ": $MSG->picmsg ($ Fromusername, $toUsername, "co-create Ying Feng on-line ceremony: free guessing four digits, in the phone 300 yuan!" "," http://www.hcyf07.com/weixin/sdd2.jpg ", ' Quiz call '," http://www.hcyf07.com "); exit (); case" Toll ": $MSG->picmsg ($ Fromusername, $toUsername, "co-create Ying Feng on-line ceremony: free guessing four digits, in the phone 300 yuan!" "," http://www.hcyf07.com/weixin/sdd2.jpg ", ' Send phone call '," http://www.hcyf07.com "); exit (); case" guessing silver ": $MSG->picmsg ($ Fromusername, $toUsername, "co-create Ying Feng on-line ceremony: free guessing four digits, in the phone 300 yuan!" "," http://www.hcyf07.com/weixin/sdd2.jpg ", ' guessing silver '," http://www.hcyf07.com "); exit ();d efault: $MSG->txtmsg ($ Fromusername, $toUsername, $default);}          if (!empty ($keyword)) {$msgType = "text"; Warehousing test//In thisCan judge the received keyword echo $resultStr;                       }else{if ($event = = "Subscribe") {//First attention $msgType = "text";                       $url = "http://www.bjcy07.com/"; $contentStr = "Hello, thank you, Beijing co-Chong Ying Fung Commodity Management Co., Ltd., Beijing, Chong Ying Fung Commodity Trading Co., Ltd. is a member of the Beijing Commodity Exchange (member seat number NO. 007), to spot silver and other precious metals sales, repurchase as the main business projects, the implementation of 24-hour trade quotes transactions , as well as investment advisory services for precious metals.                       ". $url;                      $RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $msgType, $CONTENTSTR);                                        Echo $resultStr;              } echo "Input something ...";        }/* Class of MSG */class msg{Public Function valid () {$echoStr = $_get["Echostr"];         Valid signature, option if ($this->checksignature ()) {echo $echoStr;        Exit }} #依次为 source user, send to user, time, title, picture address, Introduction, click the message when the link, of course you can modify this order function picmsg ($fromUsername, $toUsername, $title, $PICURL, $ Discription, $URL) {//get Post data, May is due to the different environments$poststr = $GLOBALS ["Http_raw_post_data"]; $time = time (); $TEXTTPL = " 
 
   
 
   %s
 
    
 
   %s
 
    
 
   
    %s 1
    
    news 
 
    
    
 
    
  
 
   
  
    <! [cdata[%s]]> 
  
    
     1 %s 
  
     
     %s 
  
     
     %s 
  
      
   
  
 
    
      
  

  
 "; $RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $title, $Discription, $PICURL, $URL); echo $resultStr;} function txtmsg ($fromUsername, $toUsername, $contentStr) {$postStr = $GLOBALS ["Http_raw_post_data"]; $time = time (); $ TEXTTPL = "
 
   
   
    %s 0 
      
  
     
 
    
    
    %s 
 
    
    %s 
 
    
    text 
 
    
    %s 
 
    /c17> 
  
  
  
  
  
 

  
 "; $RESULTSTR = sprintf ($TEXTTPL, $fromUsername, $toUsername, $time, $CONTENTSTR); Echo $resultStr; } Private Function Checksignature () {$signature = $_get["signature"]; $timestamp = $_get["timestamp"]; $nonce = $_get[" Nonce "]; $token = token, $TMPARR = Array ($token, $timestamp, $nonce), sort ($TMPARR), $tmpStr = implode ($TMPARR); $tmpStr = SHA1 ($tmp STR); if ($tmpStr = = $signature) {return true;} Else{return false;}} #匹配用户关键字function match ($rule, $keyword) {$num =count ($rule) +1; for ($i =0; $i < $num; $i + +) {if (Preg_match ("/$rule [$i]/ ", $keyword)) {return $rule [$i];exit ();}}}? >
  • 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.