您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

自动查找手机APP应用最新安装包并下载

2025/8/11 14:47:36发布30次查看
适用于app客户端的下载,直接使用即可
本人水平有限,不足之处请见谅,勿喷!望指出错误!安卓以测试,苹果未知! $value) {
        $ext = substr($value['filename'], strrpos($value['filename'], '.')+1);
        if( in_array($ext, $exts) )
        {
            $end = strrpos($value['filename'], '.');
            $start = $end - 12;
            $tmp[] = array('time' => substr($value['filename'], $start, 12), 'filepath' => $value['path'], 'filename' => $value['filename']);
        }
    }
    empty($tmp) && _jump('没有发现包!');
    $filearr = max($tmp);
    $file_path = $filearr['filepath'];
    // var_dump();die;
    // var_dump($tmp);die;
    $file_name = $filearr['filename'];
//首先要判断给定的文件存在与否 
    if(!file_exists($file_path)) { 
        _jump(没有该文件文件);
    } 
    $fp = fopen($file_path,r);
    $file_size = filesize($file_path);
    //下载文件需要用到的头 
    header(content-type: application/octet-stream);
    header(accept-ranges: bytes);
    header(accept-length:  . $file_size);
    header(content-disposition: attachment; filename= . $file_name);
    $buffer = 1024;
    $file_count = 0;
    //向浏览器返回数据 
    while(!feof($fp) && $file_count         $file_con = fread($fp,$buffer);
        $file_count += $buffer;
        echo $file_con;
    } 
    fclose($fp);
}
function _jump($message = '跳转中...', $url = null) {
    $url = $url ? $url : $_server['http_host'];
    header(refresh:3; url=http:// . $url);
    print($message . '
三秒后自动跳转首页...');
}
// 获得适合的安装包后缀
function _ext($agent = null) {
    $ext = array();
    $agent = $agent ? $agent : $_server['http_user_agent'];
    $agent = strtolower($agent);
    if (strstr($agent, 'android')) {
        $ext = array('apk');
    } else if (strstr($agent, 'iphone')) {
        $ext = array('ipa','pxl','deb');
    } else if (isset($_get['ext'])) {
        $ext = array($_get['ext']);
    }
    return $ext;
}
// 获得目录和文件
function _deepscandir($dir) {
    //return $dir;
    $filearr = array();
    $dirarr = array();
    $dir = rtrim($dir, '//');
    if(is_dir($dir)){
        $dirhandle = opendir($dir);
        while(false !== ($filename = readdir($dirhandle))){
            $subfile = $dir . $filename;
            if(is_file($subfile)){
                $filearr[] = array('path' => $subfile,'filename' => $filename);
            } elseif (is_dir($subfile) && str_replace('.', '', $filename) != ''){
                $dirarr[] = array('path' => $subfile,'filename' => $filename);
            }
        }
        closedir($dirhandle);
    }
    return array('dir' => $dirarr, 'file' => $filearr);
}
?>
down.rar ( 1.8 kb 下载:4 次 )
ad:真正免费,域名+虚机+企业邮箱=0元
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product