卖逼视频免费看片|狼人就干网中文字慕|成人av影院导航|人妻少妇精品无码专区二区妖婧|亚洲丝袜视频玖玖|一区二区免费中文|日本高清无码一区|国产91无码小说|国产黄片子视频91sese日韩|免费高清无码成人网站入口

織夢dedecms微信公眾平臺插件及跳轉(zhuǎn)wap插件手機端下載

織夢dedecms 微信公眾平臺插件及跳轉(zhuǎn)wap 插件手機端下載82015-01-30 21:52 來源/作者:懶人模板 分類:微信公眾平臺 ? ? 目前網(wǎng)上有很多這方面教程,關于dede

織夢dedecms 微信公眾平臺插件及跳轉(zhuǎn)wap 插件手機端下載

8

2015-01-30 21:52 來源/作者:懶人模板 分類:微信公眾平臺 ? ? 目前網(wǎng)上有很多這方面教程,關于dedecms 微信插件,寫的很詳細,但是都是微信跳轉(zhuǎn)的是PC 網(wǎng)頁,很難看,排版就亂了,今天南宮在這里介紹,如何跳轉(zhuǎn)到dedecms 織夢自帶wap 端,也就是跳到同內(nèi)容的手機端。

安裝dedecms 微信插件效果:在線下載地址:

安裝方法:放到dede 程序的plus 目錄下即可. (其實放在哪里都可以) 接口配置信息按下面說明填寫,

URL http://你的域名/plus/weixin.php

微信高級接口配置:Token weixin (和文件中保持一致)

,

以上都不是重點,重點是如何跳轉(zhuǎn)到dede 自帶手機端,我們先看下微信接口文件。

define("TOKEN", "weixin");

require_once(dirname(__FILE__)."/../include/common.inc.php"); $dsql = new DedeSql(false);

$wechatObj = new wechatCallback();

$wechatObj->valid();

class wechatCallback

{

private $items = '';

private $articleCount = 0;

private $keyword = '';

public function valid()

{

$echoStr = $_GET["echostr"];

//valid signature , option

if($this->checkSignature()){

,

echo $echoStr;

$this->responseMsg();

exit;

}

}

public function responseMsg()

{

//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);

$fromUsername = $postObj->FromUserName;

$toUsername = $postObj->ToUserName;

$this->keyword =

strtolower(trim(iconv("UTF-8","gb2312",$postObj->Content)));

$time = time();

$textTpl = "

".$time."

0

";

$picTpl = "

,

".$time."

d

s

1

";

if($this->keyword == 'hi' || $this->keyword == '您好' || $this->keyword == '你好' ||$this->keyword == 'hello2bizuser' ){

$contentStr = "輸入關鍵字開始搜索!";//自定義歡迎回復; echo sprintf($textTpl, $contentStr);

}else if( !empty( $this->keyword )){

$this->search();

if($this->articleCount == 0){

$contentStr = "抱歉,沒有找到與【{$this->keyword}】相關的文章,要不你更換一下關鍵字,可能就有結(jié)果了哦 :-) ";

echo sprintf($textTpl, $contentStr);

}else{

echo sprintf($picTpl,$this->articleCount,$this->items); }

}

}else {

echo "";

exit;

}

}

private function search(){

global $dsql;

,

$weixin_posts = $dsql->SetQuery("Select * From `lanren_archives` where title like '".$this->keyword."' order by id desc LIMIT 0, 5"); $items = '';

$dsql->Execute();

while($weixin_post=$dsql->GetObject()){

$title =$weixin_post->title;

$excerpt = $weixin_post->description ;//獲取摘要

$thumb = $weixin_post->litpic ;//獲取縮略圖;

$link = '/plus/view.php?aid='.$weixin_post->id;

$items = $items . $this->get_item($title, $excerpt, $thumb, $link);

$this->articleCount ;

}

if($this->articleCount > 5) $this->articleCount = 5;

$this->items = $items;

}

private function get_item($title, $description, $picUrl, $url){

if(!$description) $description = $title;

return

'

<![CDATA['.$title.']]>

';

}

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;

}

}

}

在以上代碼,大家仔細看到。紅色地方,就是文章點擊后的跳轉(zhuǎn)鏈接,目前是鏈接PC 端。 我們在看下官網(wǎng)這個兩個網(wǎng)址區(qū)別:

PC 端:http://www.lanrenmb.com/plus/view.php?aid=643

wap 端:http://www.lanrenmb.com/wap.php?action=article&id=643

通過上網(wǎng)網(wǎng)址對比,我們就知道,微信接口代碼該如何修改了。

$link = '/plus/view.php?aid='.$weixin_post->id;

改為

$link = '/wap.php?action=article&id='.$weixin_post->id;

就可以大功告成了哈!為了懶人需求,把修改好的微信接口提供下載,大家可以直接點擊下載哈。

標簽: