Public platform Development (102) template messages, 102 templates
Keywords: public platform template messages
Author: Fang Times studio
Original: http://www.cnblogs.com/txw1958/p/wechat-template-message.html
In this public platform development tutorial, we will show you how to develop a template message, that is, how to send a template message function using a program.
This article is divided into the following three sections:
I. Request template Message Permissions
Template message application requires account has been opened to pay permission.
In the background of the public platform, go to "function--add feature plug-in and template message", you can request template message.
Call the SDK to send the code as follows
1 require_once (' weixin.class.php '); 2 $weixin New class_weixin (); 3 Var_dump ($weixin->send_template_message (urldecode(Json_encode ($template)));
The implementation results are as follows:
Four, code download
Please pay attention to the double studio public account and then reply to "download template"
============================================
Double Studio public Platform account attention method:
1. Contacts-Add Friends-Find public number-search "double Studio"
2. Contacts-Add Friends-Search number-enter "Pondbaystudio"
3. Use the QR code below to scan
Public Platform Developer mode to reply to the text message code, to the full set of the best have words to explain
$RESULTSTR = " \ n <![CDATA[".$fromUsername."]]></tousername>\n <![CDATA[".$toUsername."]]></fromusername>\n ". Time ()." </createtime>\n news </msgtype>\n 1</articlecount>\n \ N <! [cdata["title"]]></title> \ n 详情请点击阅读全文</description>\n ".$picurl["roster_pic"]." </picurl>\n ".'www.baidu.com'." </url>\n </item>\n </articles>\n 0</funcflag>\n </xml> "; echo $resultStr; $resultStr = sprintf ($NEWSTPL, $fromUsername, $toUse Rname, Time (), $msgType, $title, $desription); look at you. $newstpl should be an already defined template, followed by the replacement parameters so you can see the template is correct
I'll give you an example of what I'm using in my code, and I'll replace it with the exact string.
I hope you can adopt! Thank you
Public platform reply whether the text message template can hide the date and change the default view-Full link
These are fixed styles that do not support customization.
http://www.bkjia.com/PHPjc/865480.html www.bkjia.com true http://www.bkjia.com/PHPjc/865480.html techarticle Public Platform Development (102) template message, 102 template keyword: Public platform template message Author: Fang Times Studio Original: Http://www.cnblogs.com/txw1958/p/wechat-templat ...