(PECL rar >= 0.1)
RarEntry::getHostOs — 获取条目主机操作系统
此函数没有参数。
返回主机操作系统的代码,如果出错则返回 false
。
示例 #1 RarEntry::getHostOs() 示例 (版本 >= 2.0.0)
<?php
$rar_file = rar_open('example.rar') or die("无法打开 Rar 存档");
$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("无法找到此条目");
switch ($entry->getHostOs()) {
case RarEntry::HOST_MSDOS:
echo "MS-DOS\n";
break;
case RarEntry::HOST_OS2:
echo "OS2\n";
break;
case RarEntry::HOST_WIN32:
echo "Win32\n";
break;
case RarEntry::HOST_MACOS:
echo "MacOS\n";
break;
case RarEntry::HOST_UNIX:
echo "Unix/Linux\n";
break;
case RarEntry::HOST_BEOS:
echo "BeOS\n";
break;
}
?>
示例 #2 RarEntry::getHostOs() 示例 (版本 <= 1.0.0)
<?php
$rar_file = rar_open('example.rar') or die("无法打开 Rar 存档");
$entry = rar_entry_get($rar_file, 'Dir/file.txt') or die("无法找到此条目");
switch ($entry->getHostOs()) {
case RAR_HOST_MSDOS:
echo "MS-DOS\n";
break;
case RAR_HOST_OS2:
echo "OS2\n";
break;
case RAR_HOST_WIN32:
echo "Win32\n";
break;
case RAR_HOST_MACOS:
echo "MacOS\n";
break;
case RAR_HOST_UNIX:
echo "Unix/Linux\n";
break;
case RAR_HOST_BEOS:
echo "BeOS\n";
break;
}
?>