关于微信公众号自动回复文本、图片以及图文

1.微信公众号自动回复文本:

       首先我们应该增加reply_id以及内容(content)到数据表rh_mp_reply_text,然后根据reply_id查找表rh_mp_rule的信息关键字。然后我们在回复信息的那个方法里写入以下代码:

       

               case 'text':
                    $reply=M('mp_reply_text')->find($reply_id);
                    if($reply){
                        $reply_text=$reply['content'];
                    }else{
                        $reply_text="出错了";
                    }
                    return ResponsePassive::text($request['fromusername'],$request['tousername'],$reply_text);
                    break;

      下面是将页面获取的内容写入数据表:

          

                        $model=M('mp_reply_text');
			$content=I('post.content');
			$arr['content']=$content;
			$ret=$model->add($arr);
			$m=M('mp_rule'

版权声明:本文为mo3408原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。