├── README.md
├── 前后端分离 by Pastechn
├── consts.php
├── bwg.php
└── index.html
└── 单文件版
└── index.php
/README.md:
--------------------------------------------------------------------------------
1 | # php_bwh_stock_checker
2 | PHP搬瓦工即时库存检测aff站
3 |
4 | 本项目能实现:
5 | 访问页面自动检测"即时库存"
6 | 自动对方案智能(?)分类排序
7 | 自动对方案名称简化/翻译成中文以增加可读性
8 | 自动对原本不统一的单位(MB/GB GB/TB)进行统一以增加可读性
9 | 一键显示优惠后的方案价格
10 |
11 | 本项目缺点:
12 | 就是没人走aff点进去买
13 |
--------------------------------------------------------------------------------
/前后端分离 by Pastechn/consts.php:
--------------------------------------------------------------------------------
1 | 'BWHCGLUKKB',
9 | 'discount' => 6.77,
10 | 'name' => '优惠码'
11 | ]/*,
12 | [
13 | 'code' => 'BWHNY2022',
14 | 'discount' => 12.22,
15 | 'name' => '节日优惠码'
16 | ]*/
17 | ];
18 |
19 | # 运作模式相关
20 | $cart_fetch_url = "https://bwh88.net/cart.php"; # 此处不可使用bwh81.net,会出错!建议国外vps使用bandwagonhost.com,国内vps使用bwh88.net
21 | $instant_mode = false; # 即时模式,设为true则访客每访问/刷新一次页面,服务器会向搬瓦工抓取一次数据,显示即时的库存。false为缓存模式。建议使用缓存模式。
22 | $expire = 60; # 非即时模式/缓存模式下,库存数据的过期时间,单位是秒,例如设为180就是3分钟过期。
23 | $cart_filename = "cart.txt"; # 非即时模式/缓存模式下,保存库存的文件名,默认即可。务必记得修改php文件所属用户/组为PHP所使用用户组(比如www),否则上传PHP文件默认为root会报错!
24 |
25 | # 网站相关
26 | $site_title="搬瓦工 - 即时库存检测"; # 标题,会显示在首页顶部卡片
27 | $say_something="点此获取本页面源码"; # 副标题
28 | $refer_root='https://example.com/Pastechn/bwg.php'; # 指向后端页面的地址 请务必记得同时修改index.html里158行的路径。
29 |
30 | ?>
31 |
--------------------------------------------------------------------------------
/前后端分离 by Pastechn/bwg.php:
--------------------------------------------------------------------------------
1 | $expire ) {
36 | $cart = file_get_contents($cart_fetch_url);
37 | if ( !empty($cart) ) {
38 | unlink($cart_filename);
39 | $file_cart = fopen($cart_filename, "w");
40 | fwrite($file_cart, $cart);
41 | fclose($file_cart);
42 | }
43 | }
44 | if ( empty($cart) ) {
45 | $file_cart = fopen($cart_filename, "r");
46 | $cart = fread($file_cart, filesize($cart_filename));
47 | fclose($file_cart);
48 | }
49 | } else {
50 | $cart = file_get_contents($cart_fetch_url);
51 | if ( !empty($cart) ) {
52 | $file_cart = fopen($cart_filename, "w");
53 | fwrite($file_cart, $cart);
54 | fclose($file_cart);
55 | }
56 | }
57 |
58 | }
59 |
60 | $tmp=strstr($cart, '
',$tmp);
65 |
66 | $plan_count=count($cart_explode) - 1;
67 |
68 | $plans=array();
69 |
70 | for ($i=1; $i<=$plan_count; $i++) {
71 |
72 | # name
73 | $tmp=explode('
',$cart_explode[$i]);
74 | $tmp=explode('',$tmp[1]);
75 | $tmp=$tmp[0];
76 | $tmp=str_replace('SPECIAL ','',$tmp);
77 | $tmp=str_replace('KVM - PROMO ','',$tmp);
78 | $tmp=str_replace('KVM PROMO V3 - LOS ANGELES - ','',$tmp);
79 | $tmp=str_replace('KVM PROMO V5 - LOS ANGELES - ','',$tmp);
80 | $tmp=str_replace('KVM PROMO V5 - ','',$tmp);
81 | $tmp=str_replace(' VPS','',$tmp);
82 | $tmp=str_replace('- HIBW','大流量',$tmp);
83 | $tmp=str_replace('HONG KONG','香港',$tmp);
84 | $tmp=str_replace('TOKYO','东京',$tmp);
85 | $tmp=str_replace('OSAKA','大阪',$tmp);
86 | $tmp=str_replace('DUBAI - ECOMMERCE','杜拜',$tmp);
87 | $tmp=str_replace('DUBAI','杜拜',$tmp);
88 | $tmp=str_replace(' ECOMMERCE','-E',$tmp);
89 | $tmp=str_replace('LIMITED EDITION','限量版',$tmp);
90 | $tmp=str_replace('JAPAN','日本 (软银)',$tmp); # SPECIAL 10G KVM PROMO V5 - JAPAN LIMITED EDITION # 该套餐已下架...
91 | $tmp=str_replace('SYDNEY','悉尼',$tmp);
92 | $tmp=str_replace('香港 85','香港 85 (CMI)',$tmp);
93 | $plan['name']=$tmp;
94 |
95 | # ssd
96 | $tmp=explode('SSD: ',$cart_explode[$i]);
97 | $tmp=explode('
',$tmp[1]);
98 | $tmp=$tmp[0];
99 | $tmp=str_replace(' RAID-10','',$tmp);
100 | $tmp=str_replace('GB','',$tmp);
101 | $tmp=trim($tmp) . " GB";
102 | $plan['ssd']=$tmp;
103 |
104 | # ram
105 | $tmp=explode('RAM: ',$cart_explode[$i]);
106 | $tmp=explode('
',$tmp[1]);
107 | $tmp=$tmp[0];
108 | if (strpos($tmp,'MB') !== false) {
109 | $tmp=str_replace('MB','',$tmp);
110 | $tmp=round(trim($tmp / 1024),2) . " GB";
111 | } elseif (strpos($tmp,'GB') !== false) {
112 | $tmp=str_replace('GB','',$tmp);
113 | $tmp=trim($tmp) . " GB";
114 | }
115 | $plan['ram']=$tmp;
116 |
117 | # cpu
118 | $tmp=explode('CPU: ',$cart_explode[$i]);
119 | $tmp=explode('
',$tmp[1]);
120 | $tmp=$tmp[0];
121 | $tmp=str_replace('Intel Xeon','',$tmp);
122 | $tmp=trim($tmp);
123 | $plan['cpu']=$tmp;
124 |
125 | # transfer
126 | $tmp=explode('Transfer: ',$cart_explode[$i]);
127 | $tmp=explode('
',$tmp[1]);
128 | $tmp=$tmp[0];
129 | $tmp=str_replace('/mo','',$tmp);
130 | if (strpos($tmp,'GB') !== false) {
131 | $tmp=str_replace('GB','',$tmp);
132 | $tmp=round(trim($tmp / 1000),2) . " TB";
133 | } elseif (strpos($tmp,'TB') !== false) {
134 | $tmp=str_replace('TB','',$tmp);
135 | $tmp=trim($tmp) . " TB";
136 | }
137 | $plan['transfer']=$tmp;
138 |
139 | # linkspeed
140 | $tmp=explode('Link speed: ',$cart_explode[$i]);
141 | $tmp=explode('
',$tmp[1]);
142 | $tmp=$tmp[0];
143 | $tmp=str_replace('Gigabit','Gb',$tmp);
144 | $plan['linkspeed']=$tmp;
145 |
146 | # pricing
147 | $tmp=explode('pricing textcenter"> ',$cart_explode[$i]);
148 | $tmp=explode("",$tmp[1]);
149 | $tmp=$tmp[0];
150 | $tmp=str_replace(' ','',$tmp);
151 | $tmp=str_replace("\n",'',$tmp);
152 | $tmp=str_replace('USD','',$tmp);
153 | $tmp=str_replace('Monthly','/月',$tmp);
154 | $tmp=str_replace('Quarterly','/季度',$tmp);
155 | $tmp=str_replace('Semi-Annually','/半年',$tmp);
156 | $tmp=str_replace('Annually','/年',$tmp);
157 | $tmp=str_replace('$','',$tmp);
158 | $tmp=substr($tmp,0,-5);
159 | $tmp=explode('
',$tmp);
160 | if (count($tmp) == 1) {
161 | $tmp = array($tmp[0]);
162 | } elseif (count($tmp) == 2) {
163 | $tmp = array($tmp[0],$tmp[1]);
164 | } elseif (count($tmp) == 3) {
165 | $tmp = array($tmp[0],$tmp[2]);
166 | } elseif (count($tmp) == 4) {
167 | $tmp = array($tmp[0],$tmp[3]);
168 | }
169 | $plan['pricing']=[];
170 | foreach ($tmp as $single) {
171 | $tmp2 = explode('/', $single);
172 | array_push($plan['pricing'], ['cycle'=>$tmp2[1],'pricing'=>floatval($tmp2[0])]);
173 | }
174 |
175 | # pid
176 | if (strpos($cart_explode[$i],"/cart.php?a=add&pid=") !== false) {
177 | $tmp=explode('/cart.php?a=add&pid=',$cart_explode[$i]);
178 | $tmp=explode("'",$tmp[1]);
179 | $tmp=$tmp[0];
180 | $pid=$tmp;
181 | }
182 |
183 | # link and stock
184 | if (empty($pid)) {
185 | $plan['link']=null;
186 | $plan['stock']=false;
187 | } else {
188 | $plan['link']=$refer_root . '?id=' . $pid;
189 | $plan['stock']=true;
190 | }
191 |
192 | $plans[]=$plan;
193 | unset($plan);
194 | unset($pid);
195 | }
196 | echo(json_encode(array(
197 | 'title' => $site_title,
198 | 'banner' => $say_something,
199 | 'promo' => $promo_code,
200 | 'plans' => $plans
201 | ), JSON_UNESCAPED_UNICODE));
202 |
203 | ?>
204 |
--------------------------------------------------------------------------------
/前后端分离 by Pastechn/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
搬瓦工价格表
9 |
10 |
11 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
115 |
116 |
117 |
118 |
119 |
120 | | 名称 |
121 | 折扣 |
122 | 优惠码 |
123 | 应用折扣 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 | | 名称 |
136 | CPU |
137 | RAM |
138 | 硬盘 |
139 | 流量 |
140 | 带宽 |
141 | 原价 |
142 | 折后 |
143 | 库存 |
144 | 购买链接 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
174 |
175 |
176 |
177 |
--------------------------------------------------------------------------------
/单文件版/index.php:
--------------------------------------------------------------------------------
1 | 点此获取本页面源码";
31 |
32 | // ---------- 配置部分结束 ----------
33 |
34 | $get_id = isset($_GET['id']) ? $_GET['id'] : null;
35 | $get_promo_code = isset($_GET['promo_code']) ? $_GET['promo_code'] : null;
36 |
37 | if (is_numeric($get_id)) {
38 | header("HTTP/1.1 303 See Other");
39 | if ($get_id == 0) {
40 | header("location: https://$bwh_domain/aff.php?aff=$aff");
41 | } elseif ($get_id == 1) {
42 | header("location: https://$bwh_domain/aff.php?aff=$aff&gid=1");
43 | } else {
44 | header("location: https://$bwh_domain/aff.php?aff=$aff&pid=" . $get_id);
45 | }
46 | exit;
47 | }
48 | ?>
49 |
50 |
51 |
52 |
53 |
54 |
67 |
68 |
69 |
70 | $expire ) {
78 | $cart = file_get_contents($cart_fetch_url);
79 | if ( !empty($cart) ) {
80 | unlink($cart_filename);
81 | $file_cart = fopen($cart_filename, "w");
82 | fwrite($file_cart, $cart);
83 | fclose($file_cart);
84 | }
85 | }
86 | if ( empty($cart) ) {
87 | $file_cart = fopen($cart_filename, "r");
88 | $cart = fread($file_cart, filesize($cart_filename));
89 | fclose($file_cart);
90 | }
91 | } else {
92 | $cart = file_get_contents($cart_fetch_url);
93 | if ( !empty($cart) ) {
94 | $file_cart = fopen($cart_filename, "w");
95 | fwrite($file_cart, $cart);
96 | fclose($file_cart);
97 | }
98 | }
99 |
100 | }
101 |
102 | $tmp=strstr($cart, '
');
103 | $tmp=explode('
',$tmp);
104 | $tmp=$tmp[0];
105 | $tmp=str_replace("
\n",'',$tmp);
106 | $cart_explode=explode('
',$tmp);
107 |
108 | $plan_count=count($cart_explode) - 1;
109 |
110 | $plans=array();
111 |
112 | for ($i=1; $i<=$plan_count; $i++) {
113 |
114 | # name
115 | $tmp=explode('
',$cart_explode[$i]);
116 | $tmp=explode('',$tmp[1]);
117 | $tmp=$tmp[0];
118 | $tmp=str_replace('SPECIAL ','',$tmp);
119 | $tmp=str_replace('KVM - PROMO ','',$tmp);
120 | $tmp=str_replace('KVM PROMO V3 - LOS ANGELES - ','',$tmp);
121 | $tmp=str_replace('KVM PROMO V5 - LOS ANGELES - ','',$tmp);
122 | $tmp=str_replace('KVM PROMO V5 - ','',$tmp);
123 | $tmp=str_replace(' VPS','',$tmp);
124 | $tmp=str_replace('- HIBW','大流量',$tmp);
125 | $tmp=str_replace('HONG KONG','香港',$tmp);
126 | $tmp=str_replace('TOKYO','东京',$tmp);
127 | $tmp=str_replace('OSAKA','大阪',$tmp);
128 | $tmp=str_replace('DUBAI - ECOMMERCE','杜拜',$tmp);
129 | $tmp=str_replace('DUBAI','杜拜',$tmp);
130 | $tmp=str_replace(' ECOMMERCE','-E',$tmp);
131 | $tmp=str_replace('LIMITED EDITION','限量版',$tmp);
132 | $tmp=str_replace('JAPAN','日本 (软银)',$tmp); # SPECIAL 10G KVM PROMO V5 - JAPAN LIMITED EDITION # 该套餐已下架...
133 | $tmp=str_replace('SYDNEY','悉尼',$tmp);
134 | $tmp=str_replace('香港 85','香港 85 (CMI)',$tmp);
135 | $plan['name']=$tmp;
136 |
137 | # ssd
138 | $tmp=explode('SSD: ',$cart_explode[$i]);
139 | $tmp=explode('
',$tmp[1]);
140 | $tmp=$tmp[0];
141 | $tmp=str_replace(' RAID-10','',$tmp);
142 | $tmp=str_replace('GB','',$tmp);
143 | $tmp=trim($tmp) . " GB";
144 | $plan['ssd']=$tmp;
145 |
146 | # ram
147 | $tmp=explode('RAM: ',$cart_explode[$i]);
148 | $tmp=explode('
',$tmp[1]);
149 | $tmp=$tmp[0];
150 | if (strpos($tmp,'MB') !== false) {
151 | $tmp=str_replace('MB','',$tmp);
152 | $tmp=round(trim($tmp / 1024),2) . " GB";
153 | } elseif (strpos($tmp,'GB') !== false) {
154 | $tmp=str_replace('GB','',$tmp);
155 | $tmp=trim($tmp) . " GB";
156 | }
157 | $plan['ram']=$tmp;
158 |
159 | # cpu
160 | $tmp=explode('CPU: ',$cart_explode[$i]);
161 | $tmp=explode('
',$tmp[1]);
162 | $tmp=$tmp[0];
163 | $tmp=str_replace('Intel Xeon','',$tmp);
164 | $tmp=trim($tmp);
165 | $plan['cpu']=$tmp;
166 |
167 | # transfer
168 | $tmp=explode('Transfer: ',$cart_explode[$i]);
169 | $tmp=explode('
',$tmp[1]);
170 | $tmp=$tmp[0];
171 | $tmp=str_replace('/mo','',$tmp);
172 | if (strpos($tmp,'GB') !== false) {
173 | $tmp=str_replace('GB','',$tmp);
174 | $tmp=round(trim($tmp / 1000),2) . " TB";
175 | } elseif (strpos($tmp,'TB') !== false) {
176 | $tmp=str_replace('TB','',$tmp);
177 | $tmp=trim($tmp) . " TB";
178 | }
179 | $plan['transfer']=$tmp;
180 |
181 | # linkspeed
182 | $tmp=explode('Link speed: ',$cart_explode[$i]);
183 | $tmp=explode('
',$tmp[1]);
184 | $tmp=$tmp[0];
185 | $tmp=str_replace('Gigabit','Gb',$tmp);
186 | $plan['linkspeed']=$tmp;
187 |
188 | # pricing
189 | $tmp=explode('pricing textcenter"> ',$cart_explode[$i]);
190 | $tmp=explode("",$tmp[1]);
191 | $tmp=$tmp[0];
192 | $tmp=str_replace(' ','',$tmp);
193 | $tmp=str_replace("\n",'',$tmp);
194 | $tmp=str_replace('USD','',$tmp);
195 | $tmp=str_replace('Monthly','/月',$tmp);
196 | $tmp=str_replace('Quarterly','/季度',$tmp);
197 | $tmp=str_replace('Semi-Annually','/半年',$tmp);
198 | $tmp=str_replace('Annually','/年',$tmp);
199 | $tmp=substr($tmp,0,-5);
200 | $tmp=explode('
',$tmp);
201 | if (count($tmp) == 1) {
202 | $tmp = $tmp[0];
203 | } elseif (count($tmp) == 2) {
204 | $tmp = $tmp[0] . '
' . $tmp[1];
205 | } elseif (count($tmp) == 3) {
206 | $tmp = $tmp[0] . '
' . $tmp[2];
207 | } elseif (count($tmp) == 4) {
208 | $tmp = $tmp[0] . '
' . $tmp[3];
209 | }
210 | $plan['pricing']=$tmp;
211 |
212 | # pid
213 | if (strpos($cart_explode[$i],"/cart.php?a=add&pid=") !== false) {
214 | $tmp=explode('/cart.php?a=add&pid=',$cart_explode[$i]);
215 | $tmp=explode("'",$tmp[1]);
216 | $tmp=$tmp[0];
217 | $plan['pid']=$tmp;
218 | }
219 |
220 | # link and stock
221 | if (empty($plan['pid'])) {
222 | $plan['link']='无货';
223 | $plan['stock']='
无货';
224 | } else {
225 | $plan['link']='
' . $plan['name'] . '';
226 | $plan['stock']='
有货';
227 | }
228 |
229 | # promo_code_pricing
230 | $promo_price = false;
231 | if (in_array($get_promo_code, array(1,2))) {
232 | if ($get_promo_code == 1 && is_numeric(str_replace("%",'',$promo_percentage))) {
233 | $percentage=str_replace("%",'',$promo_percentage) * 0.01;
234 | $promo_price = true;
235 | } elseif ($get_promo_code == 2 && is_numeric(str_replace("%",'',$special_promo_percentage))) {
236 | $percentage=str_replace("%",'',$special_promo_percentage) * 0.01;
237 | $promo_price = true;
238 | }
239 |
240 | if ($promo_price) {
241 |
242 | $tmp=$plan['pricing'];
243 |
244 | if (strpos($plan['pricing'],"
") !== false) {
245 | $tmp=explode('
',$tmp);
246 |
247 | $tmp[0]=str_replace('$','',$tmp[0]);
248 | $tmp[1]=str_replace('$','',$tmp[1]);
249 | $tmp[0]=explode('/',$tmp[0]);
250 | $tmp[1]=explode('/',$tmp[1]);
251 | $tmp[0][0]=$tmp[0][0] - round($tmp[0][0] * $percentage, 2);
252 | $tmp[1][0]=$tmp[1][0] - round($tmp[1][0] * $percentage, 2);
253 | $tmp[0][0]=number_format($tmp[0][0], 2, '.', '');
254 | $tmp[1][0]=number_format($tmp[1][0], 2, '.', '');
255 | $tmp[0]='$' . $tmp[0][0] . '/' . $tmp[0][1];
256 | $tmp[1]='$' . $tmp[1][0] . '/' . $tmp[1][1];
257 |
258 | $tmp=$tmp[0] . '
' . $tmp[1];
259 | } else {
260 | $tmp=str_replace('$','',$tmp);
261 | $tmp=explode('/',$tmp);
262 | $tmp[0]=$tmp[0] - round($tmp[0] * $percentage, 2);
263 | $tmp[0]=number_format($tmp[0], 2, '.', '');
264 | $tmp='$' . $tmp[0] . '/' . $tmp[1];
265 | }
266 |
267 | $plan['pricing']='
' . $tmp . '';
268 | }
269 | }
270 |
271 | $plans[]=$plan;
272 | unset($plan);
273 | }
274 |
275 | $plans_limited_edition=array();
276 | $plans_hk=array();
277 | $plans_tokyo=array();
278 | $plans_osaka=array();
279 | $plans_dubai=array();
280 | $plans_cn2_gia=array();
281 | $plans_cn2=array();
282 | $plans_general=array();
283 | $plans_others=array();
284 |
285 | foreach ($plans as $i => $plan){
286 | if (strpos($plan['name'],"FREEDOM PLAN") !== false) {
287 | $plans_limited_edition[]=$plan;
288 | }
289 | }
290 | foreach ($plans as $i => $plan){
291 | if (strpos($plan['name'],"限量版") !== false) {
292 | $plans_limited_edition[]=$plan;
293 | }
294 | }
295 | foreach ($plans as $i => $plan){
296 | if (strpos($plan['name'],"香港") !== false) {
297 | $plans_hk[]=$plan;
298 | unset($plans[$i]);
299 | }
300 | }
301 | foreach ($plans as $i => $plan){
302 | if (strpos($plan['name'],"东京") !== false) {
303 | $plans_tokyo[]=$plan;
304 | unset($plans[$i]);
305 | }
306 | }
307 | foreach ($plans as $i => $plan){
308 | if (strpos($plan['name'],"大阪") !== false) {
309 | $plans_osaka[]=$plan;
310 | unset($plans[$i]);
311 | }
312 | }
313 | foreach ($plans as $i => $plan){
314 | if (strpos($plan['name'],"杜拜") !== false) {
315 | $plans_dubai[]=$plan;
316 | unset($plans[$i]);
317 | }
318 | }
319 | foreach ($plans as $i => $plan){
320 | if (strpos($plan['name'],"CN2 GIA") !== false) {
321 | $plans_cn2_gia[]=$plan;
322 | unset($plans[$i]);
323 | }
324 | }
325 | foreach ($plans as $i => $plan){
326 | if (strpos($plan['name'],"CN2") !== false) {
327 | $plans_cn2[]=$plan;
328 | unset($plans[$i]);
329 | }
330 | }
331 | foreach ($plans as $i => $plan){
332 | if (substr($plan['name'], -1) == "G") {
333 | $plans_general[]=$plan;
334 | unset($plans[$i]);
335 | }
336 | }
337 |
338 | $plans_others=$plans;
339 | unset($plans);
340 |
341 | $plans_cheapest=array();
342 | $plans_cheapest[]=$plans_general[0];
343 | #$plans_cheapest[]=$plans_cn2[0];
344 | $plans_cheapest[]=$plans_cn2_gia[0];
345 | $plans_cheapest[]=$plans_hk[0];
346 | $plans_cheapest[]=$plans_tokyo[0];
347 | $plans_cheapest[]=$plans_osaka[0];
348 | $plans_cheapest[]=$plans_dubai[0];
349 |
350 | ?>
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
$promo_code - $promo_percentage" . ' 显示原价';
362 | } else {
363 | echo "优惠码 $promo_code - $promo_percentage" . ' 显示优惠价';
364 | }
365 | }
366 |
367 | if (!empty($promo_code) && !empty($promo_percentage) && !empty($special_promo_code) && !empty($special_promo_percentage)) {
368 | echo "
";
369 | }
370 |
371 | if (!empty($special_promo_code) && !empty($special_promo_percentage)) {
372 | if ($get_promo_code == 2 && $promo_price) {
373 | echo "节日优惠码 $special_promo_code - $special_promo_percentage" . ' 显示原价';
374 | } else {
375 | echo "节日优惠码 $special_promo_code - $special_promo_percentage" . ' 显示优惠价';
376 | }
377 | }?>
378 |
379 | "限量版",
382 | "cheapest" => "最便宜",
383 | "general" => "普通",
384 | "cn2" => "CN2",
385 | "cn2_gia" => "GIA",
386 | "hk" => "香港",
387 | "tokyo" => "东京",
388 | "osaka" => "大阪",
389 | "dubai" => "杜拜",
390 | "others" => "其他",
391 | ];
392 | foreach ( array_keys($tr_dict) as $e ) {
393 | if ( empty(${"plans_" . $e}) ) {
394 | unset($tr_dict[$e]);
395 | }
396 | }
397 | foreach ( array_keys($tr_dict) as $e ) {
398 | echo '| ';
399 | foreach ($tr_dict as $k => $v){
400 | if ( $k != array_key_first($tr_dict) ) {
401 | echo "|";
402 | }
403 | if ( $e == $k ) {
404 | echo "{$v}";
405 | } else {
406 | echo "{$v}";
407 | }
408 | }
409 | echo " | SSD | RAM | CPU | 月流量 | 端口 | 价格 | 购买链接 | 库存 |
";
410 | foreach (${"plans_" . $e} as $plan){
411 | echo '| ' . $plan['name'] . ' | ' . $plan['ssd'] . ' | ' . $plan['ram'] . ' | ' . $plan['cpu'] . ' | ' . $plan['transfer'] . ' | ' . $plan['linkspeed'] . ' | ' . $plan['pricing'] . ' | ' . $plan['link'] . ' | ' . $plan['stock'] . ' |
';
412 | }
413 | }
414 | ?>
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
--------------------------------------------------------------------------------