Scan the same QR code to access different download addresses according to browser type, browser type_PHP tutorial

WBOY
Release: 2016-07-13 10:17:21
Original
939 people have browsed it

Scan the same QR code to access different download addresses according to the browser type, browser type

<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> ?>
Copy after login

How can a string scanned by Java QR code be different from a URL? If it is a URL, how can I jump to the browser to access the URL?

Use regular expressions to determine whether it is a URL
and then use Intent to jump to the browser

Scan the QR code to download the installation file to the mobile phone. A QR code. How to tell whether the mobile phone is an IOS system or an ANDROID system?

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


Scan the same QR code to access different download addresses according to browser type, browser type_PHP tutorial

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/893872.htmlTechArticleScan the same QR code to access different download addresses according to the browser type, browser type 1? php 2 3 $ Agent = $_SERVER ['HTTP_USER_AGENT' ]; 4 preg_match ('/android|iphone/i', $Agen...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!