1 <?php
2
3 $Agent = $_SERVER['HTTP_USER_AGENT'];
4 preg_match('/android|iphone/i',$Agent,$matches);
5 if (strtolower($matches[0]) == 'android') {
6 // echo "安卓";
7 header("Location: ".$GLOBALS["public_appconfig"]["app"]['android']."'");
8 } elseif (strtolower($matches[0]) == 'iphone') {
9 header("'Location: ".$GLOBALS["public_appconfig"]["app"]['ios']."'");
10 }else{
11 //不確定是什麼系統或者是pc
12 header("Location: ".$GLOBALS["public_appconfig"]["app"]['android']."'");
13 }
14
15
16 ?>
用正則表達式來判斷是不是網址
然後用Intent跳轉到浏覽器
你可以把這兩個放到同一個網站頁面裡,然後把網址鏈接制作成二維碼,讓需要下載的人自主選擇下載,如下圖
