<span> 1</span> <?<span>php </span><span> 2</span> <span> 3</span> <span>$Agent</span> = <span>$_SERVER</span>['HTTP_USER_AGENT'<span>]; </span><span> 4</span> <span>preg_match</span>('/android|iphone/i',<span>$Agent</span>,<span>$matches</span><span>); </span><span> 5</span> <span>if</span> (<span>strtolower</span>(<span>$matches</span>[0]) == 'android'<span>) { </span><span> 6</span> <span>//</span><span> echo "安卓";</span> <span> 7</span> <span>header</span>("Location: ".<span>$GLOBALS</span>["public_appconfig"]["app"]['android']."'"<span>); </span><span> 8</span> } <span>elseif</span> (<span>strtolower</span>(<span>$matches</span>[0]) == 'iphone'<span>) { </span><span> 9</span> <span>header</span>("'Location: ".<span>$GLOBALS</span>["public_appconfig"]["app"]['ios']."'"<span>); </span><span>10</span> }<span>else</span><span>{ </span><span>11</span> <span>//</span><span>不确定是什么系统或者是pc</span> <span>12</span> <span>header</span>("Location: ".<span>$GLOBALS</span>["public_appconfig"]["app"]['android']."'"<span>); </span><span>13</span> <span> } </span><span>14</span> <span>15</span> <span>16</span> ?>
用正则表达式来判断是不是网址
然后用Intent跳转到浏览器
你可以把这两个放到同一个网站页面里,然后把网址链接制作成二维码,让需要下载的人自主选择下载,如下图