• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP finfo_open函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中finfo_open函数的典型用法代码示例。如果您正苦于以下问题:PHP finfo_open函数的具体用法?PHP finfo_open怎么用?PHP finfo_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了finfo_open函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: getMimeType

 /**
  * Detects the MIME type of a given file
  * @param string $fileName The full path to the name whose MIME type you want to find out
  * @return string The MIME type, e.g. image/jpeg
  */
 static function getMimeType($fileName)
 {
     $mime = null;
     // Try fileinfo first
     if (function_exists('finfo_open')) {
         $finfo = finfo_open(FILEINFO_MIME);
         if ($finfo !== false) {
             $mime = finfo_file($finfo, $fileName);
             finfo_close($finfo);
         }
     }
     // Fallback to mime_content_type() if finfo didn't work
     if (is_null($mime) && function_exists('mime_content_type')) {
         $mime = mime_content_type($fileName);
     }
     // Final fallback, detection based on extension
     if (is_null($mime)) {
         $extension = self::getTypeIcon(getTypeIcon);
         if (array_key_exists($extension, self::$mimeMap)) {
             $mime = self::$mimeMap[$extension];
         } else {
             $mime = "application/octet-stream";
         }
     }
     return $mime;
 }
开发者ID:jlleblanc,项目名称:joomla-media-manager,代码行数:31,代码来源:media.php


示例2: registerStaticDirectory

 /**
  * Registers all the files of a static directory as resources.
  *
  * @param string 	$path 		The absolute path on the server which contains the files
  * @param string 	$prefix 	A prefix to add to the name of the static files
  * @return Route
  */
 public function registerStaticDirectory($path)
 {
     $path = rtrim($path, '/\\');
     return $this->register('/{file}', 'get')->pattern('file', '([^\\.]{2,}.*|.)')->name($path)->before(function (&$file, &$isRightResource) use($path) {
         $file = $path . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $file);
         if (!file_exists($file) || is_dir($file)) {
             $isRightResource = false;
             return;
         }
     })->before(function ($file, $etagResponseFilter) {
         $etagResponseFilter->setEtag(md5($file . filemtime($file)));
     })->handler(function ($file, $response, $elapsedTime) {
         if (!extension_loaded('fileinfo')) {
             throw new \LogicException('The "fileinfo" extension must be activated');
         }
         $finfo = finfo_open(FILEINFO_MIME);
         $mime = finfo_file($finfo, $file);
         finfo_close($finfo);
         $pathinfo = pathinfo($file);
         if ($pathinfo['extension'] == 'css') {
             $mime = 'text/css';
         }
         if ($pathinfo['extension'] == 'js') {
             $mime = 'application/javascript';
         }
         if ($pathinfo['extension'] == 'svg') {
             $mime = 'image/svg+xml';
         }
         if (substr($mime, 0, 15) == 'application/xml' && ($pathinfo['extension'] == 'htm' || $pathinfo['extension'] == 'html')) {
             $mime = 'application/xhtml+xml';
         }
         $response->setHeader('Content-Type', $mime);
         $response->appendData(file_get_contents($file));
     });
 }
开发者ID:tomaka17,项目名称:niysu,代码行数:42,代码来源:RoutesCollection.php


示例3: mime_type

 function mime_type($file_path)
 {
     $finfo = finfo_open(FILEINFO_MIME_TYPE);
     $mime_type = finfo_file($finfo, $file_path);
     finfo_close($finfo);
     return $mime_type;
 }
开发者ID:zachborboa,项目名称:php-curl-class,代码行数:7,代码来源:Helper.php


示例4: downloadAction

 public function downloadAction()
 {
     try {
         $fileName = 'problematic_file.pdf';
         $filePath = '/ginosi/uploads/product/documents/553/2015_1421387867_Hollywood_Boulevard_Studio_Insurance_Contract_719.pdf';
         $fhandle = finfo_open(FILEINFO_MIME);
         $mime_type = finfo_file($fhandle, $filePath);
         header('Content-Type: ' . $mime_type);
         //header("Content-Length: " . filesize($filePath));
         header('Content-Disposition: attachment; filename="' . $fileName . '"');
         header('Content-Transfer-Encoding: binary');
         header('Cache-Control: no-cache');
         header('Accept-Ranges: bytes');
         // expence file download way
         //            if (file_exists($filePath)) {
         //                readfile($filePath);
         //                return true;
         //            }
         // apartment docs file download way
         echo file_get_contents($filePath, true);
         return;
     } catch (\Exception $ex) {
         echo $ex->getMessage();
     }
 }
开发者ID:arbi,项目名称:MyCode,代码行数:25,代码来源:CloudFlareController.php


示例5: getContentType

 /**
  * @return string
  */
 public function getContentType()
 {
     if (is_null($this->content_type)) {
         $this->content_type = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->getFullPath());
     }
     return $this->content_type;
 }
开发者ID:vojtabiberle,项目名称:MediaStorage,代码行数:10,代码来源:File.php


示例6: check

 /**
  * Check file mime type
  * @access	public
  * @param 	string $name
  * @param 	string $path
  * @param 	string $type
  * @return 	bool
  */
 public function check($name, $path)
 {
     $extension = strtolower(substr($name, strrpos($name, '.') + 1));
     if (function_exists('finfo_open')) {
         if ($finfo = @finfo_open(FILEINFO_MIME_TYPE)) {
             if ($mimetype = @finfo_file($finfo, $path)) {
                 @finfo_close($finfo);
                 $mime = self::getMime($mimetype);
                 if ($mime) {
                     return in_array($extension, $mime);
                 }
             }
         }
     } else {
         if (function_exists('mime_content_type')) {
             if ($mimetype = @mime_content_type($path)) {
                 $mime = self::getMime($mimetype);
                 if ($mime) {
                     return in_array($extension, $mime);
                 }
             }
         }
     }
     // server doesn't support mime type check, let it through...
     return true;
 }
开发者ID:DanyCan,项目名称:wisten.github.io,代码行数:34,代码来源:mime.php


示例7: fInstance

 /**
  * @return resource
  */
 public static function fInstance()
 {
     if (null === self::$fInstance) {
         return finfo_open(FILEINFO_MIME);
     }
     return self::$fInstance;
 }
开发者ID:judimator,项目名称:simple-search-bundle,代码行数:10,代码来源:FileIterator.php


示例8: file_mime_type

/**
 *
 * @copyright  2010-2015 izend.org
 * @version    7
 * @link       http://www.izend.org
 */
function file_mime_type($file, $encoding = true)
{
    $mime = false;
    if (function_exists('finfo_file')) {
        $finfo = finfo_open(FILEINFO_MIME);
        $mime = @finfo_file($finfo, $file);
        finfo_close($finfo);
    } else {
        if (substr(PHP_OS, 0, 3) == 'WIN') {
            $mime = mime_content_type($file);
        } else {
            $file = escapeshellarg($file);
            $cmd = "file -iL {$file}";
            exec($cmd, $output, $r);
            if ($r == 0) {
                $mime = substr($output[0], strpos($output[0], ': ') + 2);
            }
        }
    }
    if (!$mime) {
        return false;
    }
    if ($encoding) {
        return $mime;
    }
    return substr($mime, 0, strpos($mime, '; '));
}
开发者ID:RazorMarx,项目名称:izend,代码行数:33,代码来源:filemimetype.php


示例9: fileMimeType

 private function fileMimeType($filePath)
 {
     $finfo = finfo_open(FILEINFO_MIME_TYPE);
     $type = finfo_file($finfo, $filePath);
     finfo_close($finfo);
     return $type;
 }
开发者ID:simnom,项目名称:Europeana-Professional,代码行数:7,代码来源:Extension.php


示例10: getUploadedFile

function getUploadedFile($name)
{
    $tmp_name = $_FILES[$name]['tmp_name'];
    $info = finfo_open(FILEINFO_MIME_TYPE);
    $mime_type = finfo_file($info, $tmp_name);
    finfo_close($info);
    $extension = '';
    switch ($mime_type) {
        case 'image/jpeg':
            $extension = 'jpg';
            break;
        case 'image/gif':
            $extension = 'gif';
            break;
        case 'image/png':
            $extension = 'png';
            break;
        default:
            $extension = '';
    }
    if ($extension != '') {
        $image_name = pathinfo($_FILES[$name]['name'])['filename'] . '.' . $extension;
        $image_file = 'img-uploads/' . $image_name;
        try {
            move_uploaded_file($tmp_name, $image_file);
        } catch (Exception $e) {
            print_r($e);
        }
    }
    return $image_name;
}
开发者ID:koyach,项目名称:dalite,代码行数:31,代码来源:media-upload.ajax.php


示例11: getType

 public function getType()
 {
     $finfo = finfo_open(FILEINFO_MIME_TYPE);
     $type = finfo_file($finfo, $this->getFullPath());
     finfo_close($finfo);
     return $type;
 }
开发者ID:moiseh,项目名称:codegen,代码行数:7,代码来源:File.php


示例12: mime_content_type

 function mime_content_type($filename)
 {
     $finfo = finfo_open(FILEINFO_MIME);
     $mimetype = finfo_file($finfo, $filename);
     finfo_close($finfo);
     return $mimetype;
 }
开发者ID:Rudi9719,项目名称:lucid,代码行数:7,代码来源:fs.php


示例13: load

 /**
  * Loads an image from a file path
  *
  * @param string $filename Full path to the file which will be manipulated
  * @return ImageGD
  */
 public function load($filename)
 {
     if (function_exists("finfo_open")) {
         // not supported everywhere https://github.com/openphoto/frontend/issues/368
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         $this->type = finfo_file($finfo, $filename);
     } else {
         if (function_exists("mime_content_type")) {
             $this->type = mime_content_type($filename);
         } else {
             if (function_exists('exec')) {
                 $this->type = exec('/usr/bin/file --mime-type -b ' . escapeshellarg($filename));
                 if (!empty($this->type)) {
                     $this->type = "";
                 }
             }
         }
     }
     if (preg_match('/png$/', $this->type)) {
         $this->image = imagecreatefrompng($filename);
     } elseif (preg_match('/gif$/', $this->type)) {
         $this->image = @imagecreatefromgif($filename);
     } else {
         $this->image = @imagecreatefromjpeg($filename);
     }
     if (!$this->image) {
         OPException::raise(new OPInvalidImageException('Could not create image with GD library'));
     }
     $this->width = imagesx($this->image);
     $this->height = imagesy($this->image);
     return $this;
 }
开发者ID:nicolargo,项目名称:frontend,代码行数:38,代码来源:ImageGD.php


示例14: analyse

 /**
  * @param string $file
  * @return FileAnalysisResult
  */
 public static function analyse($file)
 {
     //check if file exists
     if (false === file_exists($file)) {
         return null;
     }
     //is not a file
     if (false === is_file($file)) {
         return null;
     }
     //get file size
     $size = filesize($file);
     $mimeType = null;
     //mime type getter
     if (function_exists('finfo_open')) {
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         $mimeType = finfo_file($finfo, $file);
     } else {
         if (function_exists('mime_content_type')) {
             $mimeType = mime_content_type($file);
         }
     }
     //default mime type
     if (strlen($mimeType) == 0) {
         //default mime type
         $mimeType = 'application/octet-stream';
     }
     return new FileAnalysisResult($mimeType, $size, $file);
 }
开发者ID:rugk,项目名称:threema-msgapi-sdk-php,代码行数:33,代码来源:FileAnalysisTool.php


示例15: forceDownload

function forceDownload($file)
{
    //Check file exist or not
    if (file_exists($file)) {
        if (ini_get('zlib.output_compression')) {
            // required for IE
            ini_set('zlib.output_compression', 'Off');
        }
        // Get mine type of file.
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        // return mime type ala mimetype extension
        $mimeType = finfo_file($finfo, $file) . "\n";
        finfo_close($finfo);
        header('Expires: 0');
        header('Pragma: public');
        header('Cache-Control: private', false);
        header('Content-Type:' . $mimeType);
        header('Content-Disposition: attachment; filename="' . basename($file) . '"');
        header('Content-Transfer-Encoding: binary');
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
        header('Content-Length: ' . filesize($file));
        header('Connection: close');
        readfile($file);
        exit;
    } else {
        return "File does not exist";
    }
}
开发者ID:hiiamrohit,项目名称:force-download-php,代码行数:28,代码来源:index.php


示例16: fileDownload

 public static function fileDownload($filepath, $test = false)
 {
     //prevent transverse above BROWSE_URL dir
     if (strpos(realpath($filepath), realpath(BROWSE_URL)) !== 0) {
         return false;
     }
     //for unit test, no need to download read file
     if ($test) {
         return true;
     }
     if (is_file($filepath)) {
         $size = filesize($filepath);
         if (function_exists('finfo_open')) {
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
             $mimetype = finfo_file($finfo, $filepath);
             finfo_close($finfo);
         } else {
             $mimetype = 'application/octet-stream';
         }
         //clear all output buffer
         ob_end_clean();
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Cache-Control: private', false);
         header("Content-Type: {$mimetype}");
         header("Content-Disposition: attachment; filename=\"" . basename($filepath) . '"');
         header("Content-length: " . $size);
         header("Content-Transfer-Encoding: binary");
         readfile($filepath);
     } else {
         return false;
     }
 }
开发者ID:paopaojr,项目名称:FileBrowser,代码行数:32,代码来源:FileBrowser.class.php


示例17: __construct

 function __construct($interface, $files_directory)
 {
     $field = filter_input(INPUT_POST, 'field', FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
     // Check for file upload.
     if ($field === NULL || empty($_FILES) || !isset($_FILES['file'])) {
         return;
     }
     $this->interface = $interface;
     // Create a new result object.
     $this->result = new stdClass();
     // Set directory.
     $this->files_directory = $files_directory;
     // Create the temporary directory if it doesn't exist.
     $dirs = array('', '/files', '/images', '/videos', '/audios');
     foreach ($dirs as $dir) {
         if (!H5PCore::dirReady($this->files_directory . $dir)) {
             $this->result->error = $this->interface->t('Unable to create directory.');
             return;
         }
     }
     // Get the field.
     $this->field = json_decode($field);
     if (function_exists('finfo_file')) {
         $finfo = finfo_open(FILEINFO_MIME_TYPE);
         $this->type = finfo_file($finfo, $_FILES['file']['tmp_name']);
         finfo_close($finfo);
     } elseif (function_exists('mime_content_type')) {
         // Deprecated, only when finfo isn't available.
         $this->type = mime_content_type($_FILES['file']['tmp_name']);
     } else {
         $this->type = $_FILES['file']['type'];
     }
     $this->extension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
     $this->size = $_FILES['file']['size'];
 }
开发者ID:xyulex,项目名称:h5p-editor-php-library,代码行数:35,代码来源:h5peditor-file.class.php


示例18: displayFiles

function displayFiles($path)
{
    echo "<table class='table table-hover file-list'>\n        <thead><th>Nome</th><th>Dimensione</th><th>Ultima modifica</th></thead>";
    $file_array = array_diff(scandir("../" . $path), array('..', '.', '.DS_Store'));
    foreach ($file_array as $file) {
        $url = "../" . $path . "/" . $file;
        if (is_dir($url)) {
            $name = $file;
            $folder_path = $path . "/" . $file;
            $size = formatBytes(getFolderSize($url), 1);
            $date = date("d/m/Y", stat($url)['mtime']);
            echo "<tr><td><span class='fa-stack fa-2x'><i class='fa fa-folder'></i></span> <a href='#' data-path=\"{$folder_path}\" class='file-list-folder'>{$name}</a>";
            echo "<button type='button' class='btn btn-link pull-right lmb remove-folder tooltipped' data-toggle='tooltip' title='Elimina' data-path=\"{$folder_path}\"><i class='fa fa-remove'></i></button>";
            echo "<button type='button' class='btn btn-link pull-right lmb edit-folder tooltipped' data-toggle='tooltip' title='Rinomina' data-path=\"{$folder_path}\"><i class='fa fa-edit'></i></button>";
            echo "</td><td><span class='text-muted'>{$size}</span></td><td><span class='text-muted'>{$date}</span></td></tr>";
        } else {
            $finfo = finfo_open(FILEINFO_MIME_TYPE);
            $content_type = finfo_file($finfo, $url);
            $file_icon = getFileTypeIcon($content_type, $file);
            $size = formatBytes(filesize($url), 1);
            $date = date("d/m/Y", filemtime($url));
            $preview = canPreview($content_type);
            if ($preview == "no") {
                echo "<tr><td><span class='fa-stack fa-2x'><i class='fa {$file_icon}'></i></span> <a href=\"{$url}\" class='file-list' target='_blank'>{$file}</a>";
            } else {
                echo "<tr><td><span class='fa-stack fa-2x'><i class='fa {$file_icon}'></i></span> <a href='#' data-path=\"{$url}\" data-preview_mode='{$preview}' class='file-list-previewable'>{$file}</a>";
            }
            echo "<button type='button' class='btn btn-link pull-right lmb remove-file tooltipped' data-toggle='tooltip' title='Elimina' data-path=\"{$url}\"><i class='fa fa-remove'></i></button>";
            echo "</td><td><span class='text-muted'>{$size}</span></td><td><span class='text-muted'>{$date}</span></td></tr>";
        }
    }
    echo "</table>";
}
开发者ID:borisper1,项目名称:vesi-cms,代码行数:33,代码来源:file-manager.php


示例19: getMIME

 function getMIME($fname)
 {
     $finfo = finfo_open(FILEINFO_MIME_TYPE);
     $mime = finfo_file($finfo, $fname);
     finfo_close($finfo);
     return $mime;
 }
开发者ID:edwardshe,项目名称:sublite-1,代码行数:7,代码来源:S3Controller.php


示例20: get_file_mime_type

 function get_file_mime_type($filename, $debug = false)
 {
     if (function_exists('finfo_open') && function_exists('finfo_file') && function_exists('finfo_close')) {
         $fileinfo = finfo_open(FILEINFO_MIME);
         $mime_type = finfo_file($fileinfo, $filename);
         finfo_close($fileinfo);
         if (!empty($mime_type)) {
             if (true === $debug) {
                 return array('mime_type' => $mime_type, 'method' => 'fileinfo');
             }
             return $mime_type;
         }
     }
     if (function_exists('mime_content_type')) {
         $mime_type = mime_content_type($filename);
         if (!empty($mime_type)) {
             if (true === $debug) {
                 return array('mime_type' => $mime_type, 'method' => 'mime_content_type');
             }
             return $mime_type;
         }
     }
     $mime_types = array('ai' => 'application/postscript', 'aif' => 'audio/x-aiff', 'aifc' => 'audio/x-aiff', 'aiff' => 'audio/x-aiff', 'asc' => 'text/plain', 'asf' => 'video/x-ms-asf', 'asx' => 'video/x-ms-asf', 'au' => 'audio/basic', 'avi' => 'video/x-msvideo', 'bcpio' => 'application/x-bcpio', 'bin' => 'application/octet-stream', 'bmp' => 'image/bmp', 'bz2' => 'application/x-bzip2', 'cdf' => 'application/x-netcdf', 'chrt' => 'application/x-kchart', 'class' => 'application/octet-stream', 'cpio' => 'application/x-cpio', 'cpt' => 'application/mac-compactpro', 'csh' => 'application/x-csh', 'css' => 'text/css', 'dcr' => 'application/x-director', 'dir' => 'application/x-director', 'djv' => 'image/vnd.djvu', 'djvu' => 'image/vnd.djvu', 'dll' => 'application/octet-stream', 'dms' => 'application/octet-stream', 'doc' => 'application/msword', 'dvi' => 'application/x-dvi', 'dxr' => 'application/x-director', 'eps' => 'application/postscript', 'etx' => 'text/x-setext', 'exe' => 'application/octet-stream', 'ez' => 'application/andrew-inset', 'flv' => 'video/x-flv', 'gif' => 'image/gif', 'gtar' => 'application/x-gtar', 'gz' => 'application/x-gzip', 'hdf' => 'application/x-hdf', 'hqx' => 'application/mac-binhex40', 'htm' => 'text/html', 'html' => 'text/html', 'ice' => 'x-conference/x-cooltalk', 'ief' => 'image/ief', 'iges' => 'model/iges', 'igs' => 'model/iges', 'img' => 'application/octet-stream', 'iso' => 'application/octet-stream', 'jad' => 'text/vnd.sun.j2me.app-descriptor', 'jar' => 'application/x-java-archive', 'jnlp' => 'application/x-java-jnlp-file', 'jpe' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'js' => 'application/x-javascript', 'kar' => 'audio/midi', 'kil' => 'application/x-killustrator', 'kpr' => 'application/x-kpresenter', 'kpt' => 'application/x-kpresenter', 'ksp' => 'application/x-kspread', 'kwd' => 'application/x-kword', 'kwt' => 'application/x-kword', 'latex' => 'application/x-latex', 'lha' => 'application/octet-stream', 'lzh' => 'application/octet-stream', 'm3u' => 'audio/x-mpegurl', 'man' => 'application/x-troff-man', 'me' => 'application/x-troff-me', 'mesh' => 'model/mesh', 'mid' => 'audio/midi', 'midi' => 'audio/midi', 'mif' => 'application/vnd.mif', 'mov' => 'video/quicktime', 'movie' => 'video/x-sgi-movie', 'mp2' => 'audio/mpeg', 'mp3' => 'audio/mpeg', 'mpe' => 'video/mpeg', 'mpeg' => 'video/mpeg', 'mpg' => 'video/mpeg', 'mpga' => 'audio/mpeg', 'ms' => 'application/x-troff-ms', 'msh' => 'model/mesh', 'mxu' => 'video/vnd.mpegurl', 'nc' => 'application/x-netcdf', 'odb' => 'application/vnd.oasis.opendocument.database', 'odc' => 'application/vnd.oasis.opendocument.chart', 'odf' => 'application/vnd.oasis.opendocument.formula', 'odg' => 'application/vnd.oasis.opendocument.graphics', 'odi' => 'application/vnd.oasis.opendocument.image', 'odm' => 'application/vnd.oasis.opendocument.text-master', 'odp' => 'application/vnd.oasis.opendocument.presentation', 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', 'odt' => 'application/vnd.oasis.opendocument.text', 'ogg' => 'application/ogg', 'otg' => 'application/vnd.oasis.opendocument.graphics-template', 'oth' => 'application/vnd.oasis.opendocument.text-web', 'otp' => 'application/vnd.oasis.opendocument.presentation-template', 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', 'ott' => 'application/vnd.oasis.opendocument.text-template', 'pbm' => 'image/x-portable-bitmap', 'pdb' => 'chemical/x-pdb', 'pdf' => 'application/pdf', 'pgm' => 'image/x-portable-graymap', 'pgn' => 'application/x-chess-pgn', 'png' => 'image/png', 'pnm' => 'image/x-portable-anymap', 'ppm' => 'image/x-portable-pixmap', 'ppt' => 'application/vnd.ms-powerpoint', 'ps' => 'application/postscript', 'qt' => 'video/quicktime', 'ra' => 'audio/x-realaudio', 'ram' => 'audio/x-pn-realaudio', 'ras' => 'image/x-cmu-raster', 'rgb' => 'image/x-rgb', 'rm' => 'audio/x-pn-realaudio', 'roff' => 'application/x-troff', 'rpm' => 'application/x-rpm', 'rtf' => 'text/rtf', 'rtx' => 'text/richtext', 'sgm' => 'text/sgml', 'sgml' => 'text/sgml', 'sh' => 'application/x-sh', 'shar' => 'application/x-shar', 'silo' => 'model/mesh', 'sis' => 'application/vnd.symbian.install', 'sit' => 'application/x-stuffit', 'skd' => 'application/x-koan', 'skm' => 'application/x-koan', 'skp' => 'application/x-koan', 'skt' => 'application/x-koan', 'smi' => 'application/smil', 'smil' => 'application/smil', 'snd' => 'audio/basic', 'so' => 'application/octet-stream', 'spl' => 'application/x-futuresplash', 'src' => 'application/x-wais-source', 'stc' => 'application/vnd.sun.xml.calc.template', 'std' => 'application/vnd.sun.xml.draw.template', 'sti' => 'application/vnd.sun.xml.impress.template', 'stw' => 'application/vnd.sun.xml.writer.template', 'sv4cpio' => 'application/x-sv4cpio', 'sv4crc' => 'application/x-sv4crc', 'swf' => 'application/x-shockwave-flash', 'sxc' => 'application/vnd.sun.xml.calc', 'sxd' => 'application/vnd.sun.xml.draw', 'sxg' => 'application/vnd.sun.xml.writer.global', 'sxi' => 'application/vnd.sun.xml.impress', 'sxm' => 'application/vnd.sun.xml.math', 'sxw' => 'application/vnd.sun.xml.writer', 't' => 'application/x-troff', 'tar' => 'application/x-tar', 'tcl' => 'application/x-tcl', 'tex' => 'application/x-tex', 'texi' => 'application/x-texinfo', 'texinfo' => 'application/x-texinfo', 'tgz' => 'application/x-gzip', 'tif' => 'image/tiff', 'tiff' => 'image/tiff', 'torrent' => 'application/x-bittorrent', 'tr' => 'application/x-troff', 'tsv' => 'text/tab-separated-values', 'txt' => 'text/plain', 'ustar' => 'application/x-ustar', 'vcd' => 'application/x-cdlink', 'vrml' => 'model/vrml', 'wav' => 'audio/x-wav', 'wax' => 'audio/x-ms-wax', 'wbmp' => 'image/vnd.wap.wbmp', 'wbxml' => 'application/vnd.wap.wbxml', 'wm' => 'video/x-ms-wm', 'wma' => 'audio/x-ms-wma', 'wml' => 'text/vnd.wap.wml', 'wmlc' => 'application/vnd.wap.wmlc', 'wmls' => 'text/vnd.wap.wmlscript', 'wmlsc' => 'application/vnd.wap.wmlscriptc', 'wmv' => 'video/x-ms-wmv', 'wmx' => 'video/x-ms-wmx', 'wrl' => 'model/vrml', 'wvx' => 'video/x-ms-wvx', 'xbm' => 'image/x-xbitmap', 'xht' => 'application/xhtml+xml', 'xhtml' => 'application/xhtml+xml', 'xls' => 'application/vnd.ms-excel', 'xml' => 'text/xml', 'xpm' => 'image/x-xpixmap', 'xsl' => 'text/xml', 'xwd' => 'image/x-xwindowdump', 'xyz' => 'chemical/x-xyz', 'zip' => 'application/zip');
     $ext = strtolower(array_pop(explode('.', $filename)));
     if (!empty($mime_types[$ext])) {
         if (true === $debug) {
             return array('mime_type' => $mime_types[$ext], 'method' => 'from_array');
         }
         return $mime_types[$ext];
     }
     if (true === $debug) {
         return array('mime_type' => 'application/octet-stream', 'method' => 'last_resort');
     }
     return 'application/octet-stream';
 }
开发者ID:rad4n,项目名称:erekutoro,代码行数:35,代码来源:mime_type_lib.php



注:本文中的finfo_open函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP finish函数代码示例发布时间:2022-05-15
下一篇:
PHP finfo_file函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap