1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 网页跳转到微信小程序方式整合

网页跳转到微信小程序方式整合

时间:2023-05-18 04:15:56

相关推荐

网页跳转到微信小程序方式整合

第一种:支持不在微信生态内跳转

<?php$data = '{"jump_wxa":{"path": "/pages/user/user-zhuye/user-zhuye","query": "id=' . $detailId . '","env_version":"trial"},"is_expire":true,"expire_time":' . strtotime("+ 1minute") . '}';$url = "https://api./wxa/generatescheme?access_token=" . access_token();$res = curl_post($url, $data);$res = json_decode($res, true);?><a href="<?= $res["openlink"] ?>">立即分享</a>

支持QQ浏览器哦!!!

第二种方法只支持微信生态内访问:注意事项

第三种:

只支持在微信小程序内调转外链后返回

wx.config配置​​​​​​​

<script src="http://res2./open/js/jweixin-1.6.0.js"></script>wx.config({//debug: true,appId: '',timestamp:'',nonceStr: '',signature: '',jsApiList: ['openAddress','hideAllNonBaseMenuItem','showMenuItems','updateAppMessageShareData','updateTimelineShareData','scanQRCode'],openTagList: ['wx-open-launch-weapp'] // 可选,需要使用的开放标签列表,例如['wx-open-launch-app']});wx.ready(function () {wx.updateAppMessageShareData({ title: '<?=$_title?>',desc: '<?=$_desc?>',link: '<?=$_link?>',imgUrl: '<?=$_imgUrl?>',success: function () {// 设置成功}})wx.updateTimelineShareData({ title: '<?=$_title?>',link: '<?=$_link?>',imgUrl: '<?=$_imgUrl?>',success: function () {// 设置成功}})wx.onMenuShareWeibo({title: '<?=$_title?>',desc: '<?=$_desc?>',link: '<?=$_link?>',imgUrl: '<?=$_imgUrl?>',success: function () {// 用户确认分享后执行的回调函数},cancel: function () {// 用户取消分享后执行的回调函数}});/** 微信小程序2**/$("#getWxapp2").on("click",function(){wx.miniProgram.navigateTo({url: '/pages/map/map?id=<?=$rsDG["id"]?>'});});});

注意:第二种和第三种配置wx.config方式相同

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。