码迷,mamicode.com
首页 > 微信 > 详细

php 微信分享

时间:2015-04-22 11:23:01      阅读:279      评论:0      收藏:0      [点我收藏+]

标签:

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

更多接口详情可参考:http://www.cnblogs.com/txw1958/p/weixin-js.html

微信JS SDK Demo

php 微信分享

标签:

原文地址:http://www.cnblogs.com/benlightning/p/4446699.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!