xfrontend/web/index.php
2021-05-27 18:44:11 +08:00

60 lines
1.3 KiB
PHP

<?php
function getFileList($dir){
$list = glob($dir);
return $list;
}
function setFile($filename, $writetext, $openmod='w') {
if(@$fp = fopen($filename, $openmod)) {
flock($fp, 2);
fwrite($fp, $writetext);
fclose($fp);
return true;
} else {
return false;
}
}
function getFile($filename,$clearBOM=1){
$content = '';
if(function_exists('file_get_contents')) {
@$content = file_get_contents($filename);
} else {
if(@$fp = fopen($filename, 'r')) {
@$content = fread($fp, filesize($filename));
@fclose($fp);
}
}
//清除BOM信息
if($clearBOM==1){
$charset[1]=substr($content, 0, 1);
$charset[2]=substr($content, 1, 1);
$charset[3]=substr($content, 2, 1);
if (ord($charset[1])==239 && ord($charset[2])==187 && ord($charset[3])==191) {
$content=substr($content,3);
}
}
return $content;
}
function main(){
$list = array("srczip/common.js");
$base = getFileList('srczip/base/*.js');
asort($base);
$list = array_merge($list,$base);
$js = getFileList('srczip/logic/*.js');
asort($js);
$list = array_merge($list,$js);
$jsCont = array();
foreach($list as $file){
$jsCont[] = "// {$file}";
$jsCont[] = getFile($file);
}
setFile('src/x.min.js',implode("\n",$jsCont));
echo file_get_contents('main.html');
}
main();
?>