微信分享(链接不正确)

微信分享的时候,链接不对。导致的原因可能是:浏览器中存在cookie,链接里面的一个或多个参数就存在了cookie里面。

所以在分享的时候要判断一下链接里面是否存在cookie,不存在就在分享的链接里面拼上缺少的参数,就可以了。

例如:

if ($_GPC['from'] == 'shop_qrcode' && $_GPC['shopid'] > 0) {
isetcookie('__from_shopid', $_GPC['shopid'], 30*86400); //设置cookie
$_GPC['__from_shopid'] = $_GPC['shopid'];
}
//设置分享参数
$_share = array(
'title' => $item['title'],
'link' => $_W['siteurl'],//分享链接
'imgUrl' => tomedia($item['cover']),
'content' => SupermanUtil::get_wechat_share_desc($item),
);
if ($_GPC['__from_shopid'] > 0) {
$_share['link'] .= '&__from_shopid='.$_GPC['__from_shopid'];
}
原文地址:https://www.cnblogs.com/gaojunshan/p/6603939.html