本文整理匯總了PHP中MIME_Type::getSubType方法的典型用法代碼示例。如果您正苦於以下問題:PHP MIME_Type::getSubType方法的具體用法?PHP MIME_Type::getSubType怎麽用?PHP MIME_Type::getSubType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MIME_Type
的用法示例。
在下文中一共展示了MIME_Type::getSubType方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getExtension
/**
* Return default MIME-type for the specified extension.
*
* @param string $type MIME-type
*
* @return string A file extension without leading period.
*/
function getExtension($type)
{
include_once 'MIME/Type.php';
// Strip parameters and comments.
$type = MIME_Type::getMedia($type) . '/' . MIME_Type::getSubType($type);
$extension = array_search($type, $this->extensionToType);
if ($extension === false) {
return PEAR::raiseError("Sorry, couldn't determine extension.");
}
return $extension;
}
示例2: isVendor
/**
* Is this a vendor MIME type?
*
* @note Vendor types are denoted with a leading 'vnd. in the subtype.
* @param string $type MIME type to check
* @return boolean true if $type is a vendor type, false otherwise
* @static
*/
function isVendor($type)
{
if (substr(MIME_Type::getSubType($type), 0, 4) == 'vnd.') {
return true;
}
return false;
}
示例3: testGetSubType
/**
*
*/
public function testGetSubType()
{
$this->assertEquals('plain', MIME_Type::getSubType('text/plain'));
$this->assertEquals('ogg', MIME_Type::getSubType('application/ogg'));
$this->assertEquals('*', MIME_Type::getSubType('*/*'));
$this->assertEquals('plain', MIME_Type::getSubType('text/plain;a=b'));
}