本文整理匯總了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;
}