public function testGetMimeType() { $this->assertEquals('application/xml', MimeTypes::getMimetype('file.xml')); }
/** * 获取mimetype类型 * * @param string $object * * @return string */ private function getMimeType($object, $file = null) { if (!is_null($file)) { $type = MimeTypes::getMimetype($file); if (!is_null($type)) { return $type; } } $type = MimeTypes::getMimetype($object); if (!is_null($type)) { return $type; } return self::DEFAULT_CONTENT_TYPE; }