$data[‘version’] = “2.0.3.4.2”;
$res[‘version’] = “2.0.3.4.3”;
v
e
r
L
i
s
t
A
=
e
x
p
l
o
d
e
(
′
.
′
,
(
s
t
r
i
n
g
)
verListA = explode('.', (string)
verListA=explode(′.′,(string)data[‘version’]); //当前软件版本
v
e
r
L
i
s
t
B
=
e
x
p
l
o
d
e
(
′
.
′
,
(
s
t
r
i
n
g
)
verListB = explode('.', (string)
verListB=explode(′.′,(string)res[‘version’]); //数据库版本
l
e
n
=
m
a
x
(
c
o
u
n
t
(
len = max(count(
len=max(count(verListA),count($verListB));
i
=
−
1
;
w
h
i
l
e
(
i = -1; while (
i=−1;while(i++<$len) {
echo $i;
v
e
r
L
i
s
t
A
[
verListA[
verListA[i] = intval(@
v
e
r
L
i
s
t
A
[
verListA[
verListA[i]);
if (
v
e
r
L
i
s
t
A
[
verListA[
verListA[i] < 0 ) {
v
e
r
L
i
s
t
A
[
verListA[
verListA[i] = 0; //软件版本号
}
v
e
r
L
i
s
t
B
[
verListB[
verListB[i] = intval(@
v
e
r
L
i
s
t
B
[
verListB[
verListB[i]);
if (
v
e
r
L
i
s
t
B
[
verListB[
verListB[i] < 0 ) {
v
e
r
L
i
s
t
B
[
verListB[
verListB[i] = 0; //数据库版本
}
if (
v
e
r
L
i
s
t
A
[
verListA[
verListA[i]>
v
e
r
L
i
s
t
B
[
verListB[
verListB[i]) {
KaTeX parse error: Expected 'EOF', got '}' at position 53: …/版本大小大于数据库 }̲else if (verListA[
i
]
<
i]<
i]<verListB[$i]) {
KaTeX parse error: Expected 'EOF', got '}' at position 58: …数据库 提供更新 }̲ else if (i==($len-1)) {
$status = false; //循环完毕,没发现大或者小则相等,不更新
break;
}
}