" />
本文实例为大家分享了php微信公众号音乐信息的具体代码,供大家参考,具体内容如下
高品质—-hqmusicurl低品质—-musicurl核心代码如下:
$texttpl = "<xml> <tourname><![cdata[%s]]></tourname> <fromurname><![cdata[%s]]></fromurname> <createtime>%s</createt泪作文ime> <msgtype><![cdata[music]]></msgtype> <music> <title><![cdata[欢乐颂]]></title> <description><![cdata[贝多芬]]></description> <musicurl><![cdata[http://1.dq095.applinzi.蒲松林com/欢乐颂.mp3]]&新春祝语gt;</musicurl> <hqmusicurl><![cdata[http://1.dq095.applinzi.com/欢乐颂.mp3]]></hqmusicurl> </music> <funcflag>0</funcflag> </xml>"; if(!empty( $keyword )) { $resultstr = sprintf($texttpl, $fromurname, $tourname, $time); echo $resultstr; }el{ echo "input something..."; }
index.php代码如下:
<?php/*** wechat php test *///define your tokendefine("token", "weixin");$wechatobj = new wechatcallbackapitest();$wechatobj->responmsg();class wechatcallbackapitest{ public function valid() { $echostr = $_get["echostr"]; //valid signature , option if($this->checksignature()){ echo $echostr; exit; } } public function responmsg() { //get post data, may be due to the different environments $poststr = $globals["http_raw_post_data"]; //extract post data if (!empty($poststr)){ $postobj = simplexml_load_string($poststr, 'simplexmlelement', libxml_nocdata); $fromurname = $postobj->fromurname; $tourname = $postobj->tourname; $keyword = trim($postobj->content); $time = time(); $texttpl = "<xml> 描写冬天的诗词 <tourname><![cdata[%s]]></tourname> <fromurname><![cdata[%s]]></fromurname> <createtime>%s</createtime> <msgtype><![cdata[music]]></msgtype> <music> <title&g端午节可以说快乐吗t;<![cdata[欢乐颂]]></title> <description><![cdata[贝多芬]]></description> <musicurl><![cdata[http://1.dq095.applinzi.com/欢乐颂.mp3]]></musicurl> <hqmusicurl><![cdata[http://1.dq095.applinzi.com/欢乐颂.mp3]]></hqmusicurl> </music> <funcflag>0</funcflag> </xml>"; if(!empty( $keyword )) { $resultstr = sprintf($texttpl, $fromurname, $tourname, $time); echo $resultstr; }el{ echo "input something..."; } }el { echo ""; exit; } } 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( $tmpstr ); if( $tmpstr == $signature ){ return true; }el{ return fal; } }}?>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持www.887551.com。
本文发布于:2023-04-06 17:00:50,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/bf110eafb925de80212f15e83b5c46c6.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:php微信公众号开发之音乐信息.doc
本文 PDF 下载地址:php微信公众号开发之音乐信息.pdf
留言与评论(共有 0 条评论) |