-
Notifications
You must be signed in to change notification settings - Fork 37
/
direct.php
51 lines (41 loc) · 908 Bytes
/
direct.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
<?php
//url?type=doc&name=app
// 请求类型
$type = $_GET['type'];
// 组件名称
$name = $_GET['name'];
if($type == "doc"){
header("location: ".getdoc($name));
die();
}
if($type == "demo"){
header("location: ".getdemo($name));
die();
}
function getversion($name){
$version = '1.0';
$filename = 'mobile/'.$name.'/abc.json';
if(file_exists($filename)){
$R_files[] = file_get_contents($filename);
$json = json_decode($R_files[0]);
return $json->version;
} else {
return $version;
}
}
function getdemo($name){
$version = getversion($name);
$demofile = "mobile/".$name."/".$version."/demo/";
return $demofile;
}
function getdoc($name){
$version = getversion($name);
$docfile = "mobile/".$name."/".$version."/guide/index.md";
if(file_exists($docfile)){
$dirc = "/markdown.php?".$docfile;
} else {
$dirc = "/markdown.php?mobile/".$name."/README.md";
}
return $dirc;
}
?>