當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Listing::get_mime方法代碼示例

本文整理匯總了PHP中Listing::get_mime方法的典型用法代碼示例。如果您正苦於以下問題:PHP Listing::get_mime方法的具體用法?PHP Listing::get_mime怎麽用?PHP Listing::get_mime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Listing的用法示例。


在下文中一共展示了Listing::get_mime方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: file

<?php

# Pitchfork download script
# Accepts the mask of the file (or directory) to download
# and however it want's to be downloaded.
include 'includes/pitchfork-class-listing.php';
include 'configuration/pitchfork-configuration-user.php';
//include('pitchfork-application-authenticate.php');
$listing = new Listing();
$file_temp = $listing->find_hash($_REQUEST['item'], $Cfg_FolderLoc);
$file_path = $file_temp["current_dir"];
if ($file_path) {
    $file_mime = $listing->get_mime($file_path);
    //$file_contents = $listing -> get_contents($file_path);
    $file_bytes = $listing->get_bytes($file_path);
    # Discover the file name
    $file_PathArray = explode('/', $file_path);
    //print_r($file_PathArray);
    $file_name = end($file_PathArray);
    if ($_REQUEST['mode'] == "zip") {
        $file_name .= $Cfg_CompressExt;
    }
    # IE Compatability Hack (taken from cvs.moodle.org - so thank's to them)
    if (ini_get('zlib.output_compression')) {
        ini_set('zlib.output_compression', 'Off');
    }
    # Do some headers and stuff...
    header("Accept-Ranges:bytes");
    header("Content-Length:" . $file_bytes);
    header("Content-Type:" . $file_mime);
    header("Cache-Control: public");
開發者ID:rtownsend,項目名稱:pitchfork,代碼行數:31,代碼來源:pitchfork-application-download.php


注:本文中的Listing::get_mime方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。