我正在尝试使用 Phar Classe 提取 tar 文件,但返回以下错误:
UnexpectedValueException Object ( [message:protected] => phar error: "/home/filelocation/file.tar" is a corrupted tar file (truncated) [string:Exception:private] => [code:protected] => 0 [file:protected] => /home/inplan/public_html/uncompress_files.php [line:protected] => 89 [trace:Exception:private] => Array ( [0] => Array ( [file] => /home/inplan/public_html/uncompress_files.php [line] => 89 [function] => __construct [class] => PharData [type] => -> [args] => Array ( [0] => uploads/maps/true_color_4.tar ) ) ) [previous:Exception:private] => )
PHP:
try {
$phar = new PharData('uploads/maps/true_color_'.$id_technical_report.'.tar');
$phar2 = $phar->convertToExecutable (Phar::TAR,Phar::NONE);
$phar2->extractTo('uploads/maps/');
} catch (Exception $e) {
print_r($e);
}
当我下载这个文件时,我可以使用 Winrar 正常打开和解压。
该文件由 Sentinel Hub ( https://services.sentinel-hub.com/api/v1/process )的 API 生成
任何想法为什么会发生这种情况?
谢谢