初始化代码
This commit is contained in:
35
application/api/wxapi/wxmsg/ReplyText.php
Normal file
35
application/api/wxapi/wxmsg/ReplyText.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace app\api\wxapi\wxmsg;
|
||||
|
||||
use app\api\wxapi\Base;
|
||||
|
||||
/* 回复文本消息
|
||||
* */
|
||||
class ReplyText extends Base{
|
||||
public $BaseObject;
|
||||
|
||||
public function send(){
|
||||
$EventKey=$this->BaseObject->EventKey; //事件KEY值,与自定义菜单接口中KEY值对应
|
||||
$ReplyTextModel=M("wx_reply_text")->where(['EventKey'=>$EventKey,])->order("id asc")->find();
|
||||
|
||||
$data['ToUserName']=$this->BaseObject->FromUserName;
|
||||
$data['FromUserName']=$this->BaseObject->ToUserName;
|
||||
$data['CreateTime']=time();
|
||||
$data['MsgType']='text';
|
||||
|
||||
$str=$ReplyTextModel['Content'];
|
||||
//$str="<a href='http://www.baidu.com/Wap/Shop/index.html?t={time()+60}'>登录入口,点击后失效</a><br>有效期至{date('Y-m-d H:i:s',time()+60)}";
|
||||
preg_match_all("/{(.*)}/Ums",$str,$rel);
|
||||
$rs=[];
|
||||
foreach($rel[1] as $k=>$v){
|
||||
$strs = '<?php return '.$v.'; ?>';
|
||||
$rs[$k]=eval('?>'.$strs.'<?php;');
|
||||
}
|
||||
$Content=str_replace($rel[0],$rs,$str);
|
||||
$Content=htmlspecialchars_decode($Content);
|
||||
$Content=str_replace("<br>","\n",$Content);
|
||||
$data['Content']=$Content;
|
||||
echo $this->BaseObject->ArrayToXml($data);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user