zoukankan      html  css  js  c++  java
  • PHP+微信分享自定义小图标

    微信分享以后的小图标如下图:

    <script>
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
    window.shareData = {
    "imgUrl": "<?php if(stripos('y'.$detail['start_picurl'], 'http://')!=1){echo $Think.config.HTTP_STCDOMIN;}echo $detail['start_picurl'];?>",
    "timeLineLink": "{$Think.config.HTTP_DOMIN}?g=app&m=fruit&id={$Think.get.id}&wid={$Think.get.wid}&user=",
    "sendFriendLink": "{$Think.config.HTTP_DOMIN}?g=app&m=fruit&id={$Think.get.id}&wid={$Think.get.wid}&user=",
    "weiboLink": "{$Think.config.HTTP_DOMIN}g=app&m=fruit&id={$Think.get.id}&wid={$Think.get.wid}&user=",
    "tTitle": "{$detail.a_name}",
    "tContent": "亲,请点击进入摇摇乐页面,快来参加活动吧!~",
    "fTitle": "{$detail.a_name}",
    "fContent": "亲,请点击进入摇摇乐页面,快来参加活动吧!~",
    "wContent": "亲,请点击进入摇摇乐页面,快来参加活动吧!~"
    };
    // 发送给好友
    WeixinJSBridge.on('menu:share:appmessage', function (argv) {
    WeixinJSBridge.invoke('sendAppMessage', {
    "img_url": window.shareData.imgUrl,
    "img_width": "640",
    "img_height": "640",
    "link": window.shareData.sendFriendLink,
    "desc": window.shareData.fContent,
    "title": window.shareData.fTitle
    }, function (res) {
    _report('send_msg', res.err_msg);
    })
    });

    // 分享到朋友圈
    WeixinJSBridge.on('menu:share:timeline', function (argv) {
    WeixinJSBridge.invoke('shareTimeline', {
    "img_url": window.shareData.imgUrl,
    "img_width": "640",
    "img_height": "640",
    "link": window.shareData.timeLineLink,
    "desc": window.shareData.tContent,
    "title": window.shareData.tTitle
    }, function (res) {
    _report('timeline', res.err_msg);
    });
    });

    // 分享到微博
    WeixinJSBridge.on('menu:share:weibo', function (argv) {
    WeixinJSBridge.invoke('shareWeibo', {
    "content": window.shareData.wContent,
    "url": window.shareData.weiboLink,
    }, function (res) {
    _report('weibo', res.err_msg);
    });
    });
    }, false)
    </script>

  • 相关阅读:
    基于SAR对Linux资源的监控shell脚本
    Python3+RobotFramewok 用户自定义库的开发(四)
    Python3+RobotFramewok 循环判断以及Evaluate用法(三)
    Python3+RobotFramewok 快速入门(二)
    Python3+RobotFramewok RIDE环境搭建(一)
    MySQL主从双向同步
    笔记:网络协议
    Jmeter组成结构及运行原理
    Selenium WebDriver的实现及工作原理
    Jenkins+maven环境部署
  • 原文地址:https://www.cnblogs.com/Ann-wxp/p/4076262.html
Copyright © 2011-2022 走看看