search
Homephp教程php手册微信公众平台开发(102) 模版消息,102模版

微信公众平台开发(102) 模版消息,102模版

关键字:微信公众平台 模版消息
作者:方倍工作室
原文:http://www.cnblogs.com/txw1958/p/wechat-template-message.html

 

在这篇微信公众平台开发教程中,我们将介绍如何开发模版消息,即如何用程序发送模版消息功能。
本文分为以下三个部分:


一、申请模版消息权限

模版消息的申请需账号已经开通微信支付权限。

在微信公众平台的后台,依次进入“功能->添加功能插件->模版消息”,即可申请模版消息。

调用SDK发送,代码如下

<span>1</span> <span>require_once</span>('weixin.class.php'<span>);
</span><span>2</span> <span>$weixin</span> = <span>new</span><span> class_weixin();
</span><span>3</span> <span>var_dump</span>(<span>$weixin</span>->send_template_message(<span>urldecode</span>(json_encode(<span>$template</span>))));

实现效果如下如示:

 

四、代码下载

请关注方倍工作室微信公众账号,然后回复“下载模版”

 

============================================

方倍工作室微信公众平台账号关注方法:
1. 微信通讯录-添加朋友-查找公众号-搜索“方倍工作室”
2. 微信通讯录-添加朋友-搜号码-输入“pondbaystudio”
3. 使用微信扫描下面的二维码

 

微信公众平台开发者模式回复图文消息代码,要全套的最好有文字说明的

$resultStr="\n \n \n ".time()."\n \n 1\n \n \n \n <description>\n <picurl>\n <url>\n \n \n <funcflag>0\n ";echo $resultStr;$resultStr = sprintf($newsTpl, $fromUsername, $toUsername, time(), $msgType, $title,$desription);看了下你的这句$newsTpl应该是一个已经定义好的模版,后面是替换的参数所以可以查看下模版是否正确<br>给你个我代码里面用到的例子吧,具体里面字符串的话自己替换<br>希望您能采纳!谢谢<br><br>   <p class="header2"><span class="icon i-relatedanswer"><h3 id="微信公众平台回复图文消息模板是否可以隐藏日期与更改默认的查看全文链接">微信公众平台回复图文消息模板是否可以隐藏日期与更改默认的查看全文链接</h3></span></p> <p class="best-replyer"></p> <p class="ft p1">这些都是固定样式不支持自定义的。<br>  </p> </funcflag></url></picurl></description>

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.