I have used preg_match to find a certain string. If there is xxx, I will display it as xxx
This is what I decided. As long as the string matches
But what I want to know now is
How to print a certain string?
Because the string will change, I want to print it out
I use PHP's HTTP USER AGENT to detect the device's data
Assume this paragraph
<code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36</code>
I want to print out Mac OS X 10_10_5
and display it as Mac OS X 10.10.5
and
<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><code>Mozilla/5.0 (Linux; Android 4.4.2; ASUS_T00G Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36</code></pre><div class="contentsignin">Copy after login</div></div><div class="contentsignin">Copy after login</div></div>I want to print out Android 4.4.2
and ASUS_T00G
and the last
<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><code>Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53</code></pre><div class="contentsignin">Copy after login</div></div><div class="contentsignin">Copy after login</div></div>In addition to printing out iPhone, I also want to print out OS 7_1_2
and display it as OS 7.1.2
How to detect this?
I will judge that if there is Intel Mac OS Those strings I described
How to judge this?
Reply content:
Because the string will change, I want to print it out
I use PHP's HTTP USER AGENT to detect the device's data
Assume this paragraph
<code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36</code>
and display it as
Mac OS X 10.10.5
and
<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><code>Mozilla/5.0 (Linux; Android 4.4.2; ASUS_T00G Build/KVT49L) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36</code></pre><div class="contentsignin">Copy after login</div></div><div class="contentsignin">Copy after login</div></div>
I want to print out
and
ASUS_T00G
and the last
<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false"><code>Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53</code></pre><div class="contentsignin">Copy after login</div></div><div class="contentsignin">Copy after login</div></div>
In addition to printing out iPhone, I also want to print out
and display it as
OS 7.1.2 How to detect this?
I will judge that if there is Intel Mac OS Those strings I described How to judge this?
Look at this:
https://my.oschina.net/junn/b...