本文整理汇总了PHP中PMA\libraries\Util::getCompressionMimeType方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::getCompressionMimeType方法的具体用法?PHP Util::getCompressionMimeType怎么用?PHP Util::getCompressionMimeType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA\libraries\Util
的用法示例。
在下文中一共展示了Util::getCompressionMimeType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMA_detectCompression
/**
* Detects what compression the file uses
*
* @param string $filepath filename to check
*
* @return string MIME type of compression, none for none
* @access public
*/
function PMA_detectCompression($filepath)
{
$file = @fopen($filepath, 'rb');
if (!$file) {
return false;
}
return PMA\libraries\Util::getCompressionMimeType($file);
}
示例2: detectCompression
/**
* Detects what compression the file uses
*
* @todo move file read part into readChunk() or getChunk()
* @todo add support for compression plugins
* @access protected
* @return string|false false on error, otherwise string MIME type of
* compression, none for none
*/
protected function detectCompression()
{
// suppress warnings from being displayed, but not from being logged
// f.e. any file access outside of open_basedir will issue a warning
ob_start();
$file = fopen($this->getName(), 'rb');
ob_end_clean();
if (!$file) {
$this->_error_message = Message::error(__('File could not be read!'));
return false;
}
/**
* @todo
* get registered plugins for file compression
foreach (PMA_getPlugins($type = 'compression') as $plugin) {
if ($plugin['classname']::canHandle($this->getName())) {
$this->setCompressionPlugin($plugin);
break;
}
}
*/
$this->_compression = Util::getCompressionMimeType($file);
return $this->_compression;
}