產品分析php
只要沒有將應用投放到蘋果商店或Googleplay的app在微信內是禁止下載的。蘋果用戶需點擊右上角的圖標前往Safari下載,安卓用戶要麼直接下載要麼前往手機默認瀏覽器下載,但這兩種方法實現的前提是微信沒有屏蔽你的下載連接。一旦被屏蔽了用戶在微信中是打不開連接的。這對用戶的體驗來講等因而砍了一刀,可想而知轉化率天然就很低。css
下面給你們介紹一種方法能夠實現微信內直接下載app的功能,徹底KO如今你們在用的微信跳轉功能。html
實現教程:http://sk.go51w.cn/nt0032.htmlandroid
功能實現效果ios
首先咱們須要對分享域名加JS防封接口,而後咱們再加入瀏覽器外跳接口,以達到咱們的指望需求。web
功能實現後,ios系統可在微信內直接下載app,安卓系統則自動打開手機瀏覽器下載app,若是不含下載文件,則直接打開網頁。下面是含app下載的實現相關的實現效果:編程
1. App Store應用實現效果json
2. 企業版app實現效果瀏覽器
3. 安卓用戶則自動打開手機瀏覽器訪問網頁或者下載app。微信
功能完成後,再加入跳轉接口,用戶在微信內打開則直接下載文件或跳轉到手機瀏覽器打開指定h5頁面了。
如此一來咱們就解決了域名被微信攔截的問題了,那麼接下來就能夠在微信內大量的分享連接或二維碼來進行宣傳引流了。也可以極大地提升本身的APP在微信中的推廣轉化率,充分利用微信的用戶羣體來增長收益。
1. html代碼
function isWx(){//判斷是否爲微信
var ua = window.navigator.userAgent.toLowerCase(); if(ua.match(/MicroMessenger/i) == 'micromessenger'){ return true; } return false; }; if(isWx()){//判斷瀏覽器是否微信
var html='<div class="box"><img src="images/head.png"></box>' layer.open({//這裏使用了layer的彈窗組件,你也能夠本身寫
type: 1,content: html,anim: 'up', style: 'position:fixed; bottom:0; left:0; width: 100%; height: 100%; padding:0; border:none;' }); return; }<--有不懂的加我q:511979480-->
2.JS代碼
<?php function get_ticket($code){ //初始化
$ch = curl_init(); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); // https請求 不驗證證書和hosts
$headers = array(); $headers[] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_1_2 like Mac OS X; zh-CN) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/15B202 UCBrowser/11.7.7.1031 Mobile AliApp(TUnionSDK/0.1.20)'; $headers[] = 'Referer: https://m.mall.qq.com/release/?busid=mxd2&ADTAG=jcp.h5.index.dis'; $headers[] = 'Content-Type:application/x-www-form-urlencoded; charset=UTF-8'; curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $content = curl_exec($ch); curl_close($ch); //$arr = json_decode($content,1); //if($arr['success'] == '1'){ // $shotCode = $arr['shotCode']; //}else{ // $shotCode = ''; //} //preg_match('/openlink\":\"(.*?)\"}/',$content,$result); //$url = $result[1];
preg_match('/href=\"(.*?)#wechat/',$content,$result); $url = $result[1]; return $url; } $time = time()-$info['ticket_time']; $minute=floor($time/60); query_update ( "jump_logs", "count=count+1". " where code='" . $code . "'" ); if($minute >= 59){ //若是超過1小時,更新ticket
$url = get_ticket($w_url_code); if($url){ query_update ( "jump_logs", "ticket_time='".time()."', ticket='" . $url . "' where code='" . $code . "'" ); $ticket_url = $url.'#'; if(strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')||strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')){//安卓百度手機APP
echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4¶ms=%7b%22intent%22%3a%22'.$url.'%23wechat_redirect%23wechat_redirect%23Intent%3bend%22%7d";</script>'; }else{ echo '<script>window.location.href = "'.$ticket_url.'";</script>'; } } }else{ $ticket_url = $info['ticket'].'#'; if(strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')||strpos($_SERVER['HTTP_USER_AGENT'], 'baiduboxapp')){//安卓百度手機APP
echo '<script>window.location.href = "bdbox://utils?action=sendIntent&minver=7.4¶ms=%7b%22intent%22%3a%22'.$info['ticket'].'%23wechat_redirect%23wechat_redirect%23Intent%3bend%22%7d";</script>'; }else{ echo '<script>window.location.href = "'.$ticket_url.'";</script>'; } } } ?>
<!--有不懂的地方聯繫個人Q:511979480-->
3.css代碼
function isDevice(){//判斷是android仍是ios仍是web
var ua = navigator.userAgent.toLowerCase(); if(ua.match(/iPhone\sOS/i) == "iphone os" || ua.match(/iPad/i)=="ipad"){//ios
return "iOS"; } if(ua.match(/Android/i) == "android") { return "Android"; } return "Web"; };
header("Content-type:application/pdf"); header("Content-Disposition:attachment;filename='downloaded.pdf'");