本文整理汇总了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'));
}