本文整理汇总了PHP中filesystem::chroot_fopen方法的典型用法代码示例。如果您正苦于以下问题:PHP filesystem::chroot_fopen方法的具体用法?PHP filesystem::chroot_fopen怎么用?PHP filesystem::chroot_fopen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类filesystem
的用法示例。
在下文中一共展示了filesystem::chroot_fopen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: filetypes
$filetypes = new filetypes();
$path = smartstrip($_REQUEST['path']);
$group_folders = get_group_folders($GO_SECURITY->user_id, 0);
if (is_group_folder($group_folders, $path) || $fs->has_read_permission($GO_SECURITY->user_id, $path) || $fs->has_write_permission($GO_SECURITY->user_id, $path)) {
$filename = basename($path);
$extension = get_extension($filename);
$type = $filetypes->get_type($extension);
$browser = detect_browser();
header('Content-Type: ' . $type['mime']);
header('Content-Length: ' . $fs->chroot_filesize($path));
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if ($browser['name'] == 'MSIE') {
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $filename . '"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Type: ' . $type['mime']);
header('Pragma: no-cache');
header('Content-Disposition: attachment; filename="' . $filename . '"');
}
header('Content-Transfer-Encoding: binary');
$fd = $fs->chroot_fopen($path, 'rb');
while (!feof($fd)) {
print fread($fd, 32768);
}
fclose($fd);
} else {
header('Location: ' . $GO_CONFIG->host . 'error_docs/401.php');
exit;
}