<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> ?>
Use regular expressions to determine whether it is a URL
and then use Intent to jump to the browser
You can put these two on the same website page, and then make the URL link into a QR code, so that people who need to download can choose to download, as shown below