Lookup file extensions by MIME type
array Core_File::exts_by_mime( string $type )
参数列表
参数 类型 描述 默认值 $typestringFile MIME type 
array File extensions matching MIME typepublic static function exts_by_mime($type)
{
	static $types = array();
	// Fill the static array
	if (empty($types))
	{
        $mimes = Core::config('mimes');
		foreach ($mimes as $ext => $ms)
		{
			foreach ($ms as $mime)
			{
				if ($mime == 'application/octet-stream')
				{
					// octet-stream is a generic binary
					continue;
				}
				if (!isset($types[$mime]))
				{
					$types[$mime] = array( (string)$ext );
				}
				elseif (!in_array($ext, $types[$mime]))
				{
					$types[$mime][] = (string)$ext;
				}
			}
		}
	}
	return isset($types[$type])?$types[$type]:false;
}