巅云门户建站系统V8.0- 搭载巅云双向绑定可视化布局系统4.0可视化建站引擎,采用Thinkphp6+Vue.js高性能 高可控 模块化、组件式设计,自由灵活 网站功能不再单调 PC、手机、微站、小程序多前端拖拽适配 多种营销功能选配一并拥有!
支持企业站+门户站(资讯+视频+分类信息)+专业商城+自助建站平台(域名注册、网站开设、域名绑定、模板生成)+专业PS级傻瓜式可视化网站制作后台+模块风格100%自定,专为成熟的网络公司搭建自己的建网站平台而生.....
微信开发很简单,官网也提供DEOM文档,但难在如何从数据库读取整合到文档中,也就是数据拼接。本代码是我司开发中实现原理分享出来的,如果你正在开发那么一起来学习吧。
实现功能:当用户输入聊天内容给公众号时根不同词从数据库读取新闻或产品以图文形式返回给用户。当然如果你也是网站建设从业者可以购买我司的建站系统平台版,可二次开发。详情登陆:http://www.rzxsoft.cn/design/#websites-taocan 1880元起(单用户),多用户版(8000元,自助建站平台)
<?phpdefine("TOKEN", "dy_website");//与管理平台的TOKEN设置一致$wechatObj = new wechatCallbackapiTest();//$wechatObj->valid();if(isset($_GET["echostr"])){$wechatObj->valid();}else{ session_start();require_once("../common/init.php");$web=get_web(); $wechatObj->responseMsg(); }class wechatCallbackapiTest{ public function valid()//验证接口用,管理平台后台设置的时候请调用此方法进行验证 { $echoStr = $_GET["echostr"]; if($this->checkSignature()){ echo $echoStr; exit; } } public function responseMsg()//接受用户信息并返回图文信息 { $postStr = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : file_get_contents("php://input"); if (!empty($postStr)){ $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA); $fromUsername = $postObj->FromUserName; $toUsername = $postObj->ToUserName; $keyword = trim($postObj->Content); $msgType=$postObj->MsgType; $latitude=$postObj->Location_x; $longitude=$postObj->Location_y; $event=$postObj->Event; $eventKey=$postObj->EventKey; $time = time(); $textTpl = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[%s]]></MsgType> <Content><![CDATA[%s]]></Content> <FuncFlag>0</FuncFlag> </xml>"; //加载图文模版 $picTpl = "<xml> <ToUserName><![CDATA[%s]]></ToUserName> <FromUserName><![CDATA[%s]]></FromUserName> <CreateTime>%s</CreateTime> <MsgType><![CDATA[%s]]></MsgType> <ArticleCount>%s</ArticleCount> %s <FuncFlag>1</FuncFlag> </xml> "; if($msgType == "event" and $Event == "subscribe")//判断是否是新关注 { $msgType = "text"; $contentStr = "您好,欢迎您关注巅云智能建站系统PHP开发网"; $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr); echo $resultStr; }elseif($msgType == "event" and $event=="CLICK" or !empty($keyword))//用户输入的内容 { $msgType = "news"; session_start();require_once("../common/init.php");$web=get_web();$con=mysql_connect(DB_SERVER,DB_LOGIN,DB_PW) or die("Unable to connect to the MySQL!");$db = mysql_select_db(DB_NAME,$con); $sqlF = "select * from products where show_index=0 and Type='product' and user='$web' and (ProductName like '%$keyword%' or txtDetail like '%$keyword%' or ProductIntro like '%$keyword%' or Price like '%$keyword%') "; $rsF = mysql_query($sqlF);$countF = mysql_num_rows($rsF);//产品if(strpos($keyword, "产品") !== false or $countF>=1 ){ if(strpos($keyword, "产品") !== false){ $wheres=""; } else{ $wheres="and (ProductName like '%$keyword%' or txtDetail like '%$keyword%' or ProductIntro like '%$keyword%' or Price like '%$keyword%')"; } $sqlc = "select * from products where show_index=0 and Type='product' and user='$web' $wheres";$rsc = mysql_query($sqlc);$countpro = mysql_num_rows($rsc);if($countpro>8) {$countpro=7;}$sql = "select * from products where show_index=0 and Type='product' and user='$web' $wheres order by rand() limit 40 ";$rs = mysql_query($sql); $strpro='<Articles>';while($row_p=mysql_fetch_assoc($rs)){ $Content1=mb_substr(strip_tags(str_replace(' ','',str_replace('"','', $row_p['txtDetail']))),0,25,'utf-8')."";$row_p['ProductName'] = mb_substr($row_p['ProductName'],0,12,'utf-8').""; $Contentall1=$row_p['txtDetail'];$PInfo=PInfo($row_p['IDProduct']);if($PInfo['iPrice']){$PInfo['iPrice']=" ¥".$PInfo['iPrice'];}else{$PInfo['iPrice']=$PInfo['iPrice'];}$query1 ="select pro_open_pageid from notes where showIndex=1 and pro_open_pageid !='' and note_class='product' and user='$web' and mobile='1' ";$rscp = mysql_query($query1);$rscpageid = mysql_fetch_row($rscp);$page_open=$rscpageid[0];$httpurl=$httpurl1="http://".$_SERVER['HTTP_HOST'];$pics = json_decode($row_p['pics'], true); if (isset($pics)) { foreach ($pics as $key=>$v) {$picinfo[$key]= $picinfo[$key];$row_p['pic']=$pics[0];}}$src1 = $row_p['pic']; if($src1==""){ $src1 = "/admin/images/dingdan.png";} if(stripos($src1,'http://') !== false){$httpurl="";} $strpro.="<item> <Title><![CDATA[{$row_p['ProductName']}{$PInfo['iPrice']} ]]></Title> <Description><![CDATA[{$Content1}]]></Description> <PicUrl><![CDATA[{$httpurl}/{$src1}]]></PicUrl> <Url><![CDATA[{$httpurl1}/mobile/index.php?proID={$row_p['IDProduct']}&page_id={$page_open}]]></Url> </item>";} $strpro.='</Articles>'; $resultStr = sprintf($picTpl, $fromUsername, $toUsername, strtotime($row_p['dtCreate']), $msgType,$countpro, $strpro);if($countpro==0){ $msgType = "text"; $contentStr = "没找到任何相关内容产品!"; $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr); }}//产品overelse {$sqlc = "select * from news where showIndex=1 and user='$web' and (NewsID like '%$keyword%' or Title like '%$keyword%' or Content like '%$keyword%') ";$rsc = mysql_query($sqlc);$countnews = mysql_num_rows($rsc);if($countnews>8) {$countnews=7;}$sql = "select * from news where showIndex=1 and user='$web' and (NewsID like '%$keyword%' or Title like '%$keyword%' or Content like '%$keyword%') limit 40 ";$rs = mysql_query($sql); $strnews='<Articles>';while($row_p=mysql_fetch_assoc($rs)){ $Content1=mb_substr(strip_tags(str_replace(' ','',str_replace('"','', $row_p['Content']))),0,25,'utf-8')."";$row_p['Title'] = mb_substr($row_p['Title'],0,12,'utf-8').""; $Contentall1=$row_p['Content'];preg_match_all('/<img[^>]*src\s?=\s?[\'|"]([^\'|"]*)[\'|"]/is', $Contentall1, $picarr); $query1 ="select news_open_pageid from notes where showIndex=1 and news_open_pageid !='' and note_class='news' and user='$web' and mobile='1' ";$rscp = mysql_query($query1);$rscpageid = mysql_fetch_row($rscp);$page_open=$rscpageid[0];$httpurl=$httpurl1="http://".$_SERVER['HTTP_HOST'];$src1 = $picarr[1][0]; if(stripos($src1,'http://') !== false){$httpurl="";}if($src1!=""){ $strnews.="<item> <Title><![CDATA[{$row_p['Title']}]]></Title> <Description><![CDATA[{$Content1}]]></Description> <PicUrl><![CDATA[{$httpurl}/{$src1}]]></PicUrl> <Url><![CDATA[{$httpurl1}/mobile/index.php?NewsID={$row_p['NewsID']}&page_id={$page_open}]]></Url> </item>";}} $strnews.='</Articles>'; $resultStr = sprintf($picTpl, $fromUsername, $toUsername, strtotime($row_p['dtCreate']), $msgType,$countnews, $strnews);if($countnews==0){ $msgType = "text"; $contentStr = "没找到任何相关内容!!"; $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr); }} echo $resultStr; }else{ echo "说点什么吧!"; } }else { 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; }else{ return false; } }}?>
2026-07-05
本系统是一套基于 ThinkPHP 8 + Workerman 架构的高性能交友平台源码,覆盖从「用户注册认证」到「互动交友」再到「增值变现」的完整闭环。

2026-06-21
基于 ThinkPHP 6 + MySQL + Workerman 的全栈婚恋交友平台,支持 PC(SEO 优化)、小程序/App(uni-app 二期),集成 AI 智能匹配、AI 快速回复、AI

2026-05-27

2026-04-27

2026-04-21

2026-03-28
一款集多平台API接入、VEO3与SORO2视频生成、图片生成及大语言模型于一体的AI短视频生成平台源码正式发布,为开发者与企业提供一站式智能创作解决方案。

2026-03-10
还在为服务器被攻击而彻夜难眠?一劳永逸,免费终身 1. IP行为分析 - 5分钟内识别异常请求 2. UA指纹识别 - 区分搜索引擎、普通用户、恶意工具 3. 端口扫描检测 - 发现即封禁,不留情面

2026-03-06
本文介绍如何为同一套程序、同一站点绑定多个域名并配置独立的SSL证书,通过PHP执行Nginx重载命令,实现多站点独立server配置的自动化管理。
巅云门户自助建站系统v8.0
重庆楚捷科技有限公司 一佰互联网站制作 @ 2022 版权所有 ICP备:渝ICP备16004678号 php培训 自助建站
关注巅云建站

世界从来不缺少好的程序员,而稀缺的是优秀的软件架构思想者