zoukankan      html  css  js  c++  java
  • php 微信分享

    1.引入jssdk wechat-php-jssdk.zip (其中两个json文件需要读写权限)

    <?php
    require_once "./jssdk.php";
    $jssdk = new JSSDK("APPID", "APPSECRET");
    $signPackage = $jssdk->GetSignPackage();
    ?>

    2.js分享代码

    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
    <script>
      wx.config({
        debug: false,
        appId: '<?php echo $signPackage["appId"];?>',
        timestamp: <?php echo $signPackage["timestamp"];?>,
        nonceStr: '<?php echo $signPackage["nonceStr"];?>',
        signature: '<?php echo $signPackage["signature"];?>',
        jsApiList: [
            'onMenuShareTimeline',
            'onMenuShareAppMessage',
            'onMenuShareQQ',
            'onMenuShareWeibo',
          // 所有要调用的 API 都要加到这个列表中
        ]
      });
      var title = '';
      var desc = '';
      var link = '';
      var imgUrl = '';
      wx.ready(function () {
          wx.onMenuShareAppMessage({
              title: title,
              desc: desc,
              link: link,
              imgUrl: imgUrl
            });
          wx.onMenuShareTimeline({
              title: title,
              desc: desc,
              link: link,
              imgUrl: imgUrl
            });
          wx.onMenuShareQQ({
              title: title,
              desc: desc,
              link: link,
              imgUrl: imgUrl
            });
          wx.onMenuShareWeibo({
              title: title,
              desc: desc,
              link: link,
              imgUrl: imgUrl
            });
      });
    </script>

    微信JS-SDK说明文档:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html

    微信JS SDK Demo

  • 相关阅读:
    Filter and Listener
    Cookie Session
    怎样快速将一台电脑虚拟机导入另外一台电脑
    网页下载文件服务端代码
    图片验证码生成代码
    Request实战
    Response
    设置页眉页脚的距离
    页眉页脚的设置
    节的设置
  • 原文地址:https://www.cnblogs.com/benlightning/p/4446699.html
Copyright © 2011-2022 走看看