微信公衆號開發(151)——圖文消息生成表格微信
$rabbitfollow = "<p><img data-type='gif' data-src='https://mmbiz.qpic.cn/mmbiz_gif/BIZBsErRy2ibgbtkAF72c3AicWkRxDzXAjL0yk8DOnmzcxoticnibOeia05zHdEL6gjxXEGHV4b8aFpSW4W7gsWLC3g/0?wx_fmt=gif' data-ratio='0.11875' data-w='640'/></p><p><br/></p>"; $replymethod = "<p style='text-align: center;'>關注 東購 公衆號,回覆數字編號獲取</p><p style='text-align: center;'><img data-src='https://mmbiz.qpic.cn/mmbiz_png/BIZBsErRy28WK7t8ah9KruBrKhmkeqzibkDfr9u34LfCpdxELqMVLnAktibHW7BdHznlia9KuJqKK1PHr8nfXW3Jg/0?wx_fmt=png' data-type='png' style='width: 100%;height: auto;'/></p><p><br/></p>"; $functionlist = "<p><br/></p><b><table border='1' cellspacing='1' cellpadding='1'> <caption style='color:#DAA520'><strong>資源分類列表(點擊藍字進入)<strong></caption> <tr align='center'> <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/wOQHzpAhSrbZJ8PK5ELI-A'>特異功能</a></td> <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/HgjPPmsjEaAogsbU3Nb92A'>紅包口令</a></td> <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/GKXN7MtEglrec8Itrm5pyw'>嘀嘀打車</a></td> </tr> <tr align='center'> <td><a href='http://buy.fangbei.org/Yhqhome/goods/index'>京東爆款</a></td> <td><a href='http://buy.fangbei.org/yhqhome/coupon/index'>京東優惠</a></td> <td><a href='http://buy.fangbei.org/yhqhome/activity/index'>京東活動</a></td> </tr> <tr align='center'> <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/Lbb46cLtvxdXbycPe9Fg3Q'>免費小說</a></td> <td><a href='http://buy.fangbei.org/yhqweui/wx/mp/s/NsYkhtvT7leCLqZUoRRFAw'>生活技能</a></td> <td>敬請期待</td> </tr> </table></b>";
public function updateFiction(){ Vendor('Weixin.wxyhq_class'); $weixin = new \weixin(); $resource = M('resource','tp_'); $map['category'] = "FICTION"; $arr = $resource->order('id asc')->where($map)->limit(200)->select(); $content = ""; // $content .= $this->rabbitfollow; $content .= $this->replymethod; $content .= "<table border='1' cellspacing='1' cellpadding='1'> <tr align='center'> <td>編號</td> <td>小說名稱</td> <td>積分</td> </tr>"; foreach($arr as $item){ $content .= " <tr > <td align='center' style='color:OrangeRed'>".$item["id"]."</td> <td>".$item["title"]."</td> <td align='center'>".($item["startscore"] + $item["consumescore"])."</td> </tr>"; } $content .= "</table> "; $content .= $this->functionlist; var_dump($content); $news = array( "media_id"=>"bntHjEN8oAlFVjW3oT2XNcnU7KFajPhNGxixMzj9TWI", "index"=>"3", "articles"=> array("title"=>"免費熱門小說列表", "thumb_media_id"=>"bntHjEN8oAlFVjW3oT2XNa6PS1YZo31ClkDtFRMvTMo", "author"=>"", "digest" =>"關注 東購 公衆號還有更多料", "show_cover_pic" =>"0", "content" =>$content, "content_source_url" =>"", ) ); $result = $weixin->update_permanent_news($news); header('Location:http://mp.weixin.qq.com/s/Lbb46cLtvxdXbycPe9Fg3Q'); }