-
Notifications
You must be signed in to change notification settings - Fork 0
/
manger.php
153 lines (149 loc) · 4.03 KB
/
manger.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?php
//读取json数据库文件
$json = 'data/test.json';
$data = json_decode(file_get_contents($json), true);
//统计数量
//友好生物页面数量
$fnum = $data["entity"]["friendly"];
//中立生物页面数量
$nnum = $data["entity"]["neutral"];
//敌对生物页面数量
$hnum = $data["entity"]["hostile"];
//物品页面数量
$inum = $data["item"];
//方块页面数量
$bnum = $data["block"];
/*
编码区
*/
//给json文件中的数据进行数据转换
//enity
//友好生物
for ($i = 1; $i <= count($fnum); $i++) {
$ftitle = $data["entity"]['friendly']["$i"]["enname"];
$fenname = $data["entity"]['friendly']["$i"]["enname"];
$fzhname = $data["entity"]['friendly']["$i"]["zhname"];
$ftext = $data["entity"]['friendly']["$i"]["text"];
$fimg = $data["entity"]['friendly']["$i"]["imge"];
}
//中立生物
for ($i = 1; $i <= count($nnum); $i++) {
$ntitle = $data["entity"]['neutral']["$i"]["enname"];
$nenname = $data["entity"]['neutral']["$i"]["enname"];
$nzhname = $data["entity"]['neutral']["$i"]["zhname"];
$ntext = $data["entity"]['neutral']["$i"]["text"];
$nimg = $data["entity"]['neutral']["$i"]["imge"];
}
//敌对生物
for ($i = 1; $i <= count($hnum); $i++) {
$htitle = $data["entity"]['hostile']["$i"]["enname"];
$henname = $data["entity"]['hostile']["$i"]["enname"];
$hzhname = $data["entity"]['hostile']["$i"]["zhname"];
$htext = $data["entity"]['hostile']["$i"]["text"];
$himg = $data["entity"]['hostile']["$i"]["imge"];
}
//block
for ($i = 1; $i <= count($bnum); $i++) {
$btitle = $data["block"]["$i"]["enname"];
$benname = $data["block"]["$i"]["enname"];
$bzhname = $data["block"]["$i"]["zhname"];
$btext = $data["block"]["$i"]["text"];
$bimg = $data["block"]["$i"]["imge"];
}
//item
for ($i = 1; $i <= count($inum); $i++) {
$ititle = $data["item"]["$i"]["enname"];
$ienname = $data["item"]["$i"]["enname"];
$izhname = $data["item"]["$i"]["zhname"];
$itext = $data["item"]["$i"]["text"];
$iimg = $data["item"]["$i"]["imge"];
}
/*
生成区
*/
//enity
//友好生物
for ($i = 1; $i <= count($fnum); $i++) {
file_put_contents("pages/entity/friendly/$i.html", "<!DOCTYPE html>
<html>
<head>
<title>$ftitle</title>
<meta charset='UTF-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'/>
</head>
<body>
<img src='$fimg'>
<p>英文名$fenname</p>
<p>中文名$fzhname</p>
<p>$ftext</p>
</body>
</html>");
}
//中立生物
for ($i = 1; $i <= count($nnum); $i++) {
file_put_contents("pages/entity/neutral/$i.html", "<!DOCTYPE html>
<html>
<head>
<title>$ntitle</title>
<meta charset='UTF-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'/>
</head>
<body>
<img src='$nimg'>
<p>英文名$nenname</p>
<p>中文名$nzhname</p>
<p>$ntext</p>
</body>
</html>");
}
//敌对生物
for ($i = 1; $i <= count($hnum); $i++) {
file_put_contents("pages/entity/hostile/$i.html", "<!DOCTYPE html>
<html>
<head>
<title>$htitle</title>
<meta charset='UTF-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'/>
</head>
<body>
<img src='$himg'>
<p>英文名$henname</p>
<p>中文名$hzhname</p>
<p>$htext</p>
</body>
</html>");
}
//block
for ($i = 1; $i <= count($bnum); $i++) {
file_put_contents("pages/block/$i.html", "<!DOCTYPE html>
<html>
<head>
<title>$btitle</title>
<meta charset='UTF-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'/>
</head>
<body>
<img src='$bimg'>
<p>英文名$benname</p>
<p>中文名$bzhname</p>
<p>$btext</p>
</body>
</html>");
}
//item
for ($i = 1; $i <= count($inum); $i++) {
file_put_contents("pages/item/$i.html", "<!DOCTYPE html>
<html>
<head>
<title>$ititle</title>
<meta charset='UTF-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0'/>
</head>
<body>
<img src='$iimg'>
<p>英文名$ienname</p>
<p>中文名$izhname</p>
<p>$itext</p>
</body>
</html>");
}