本文整理汇总了PHP中Utilities::getMimeType方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::getMimeType方法的具体用法?PHP Utilities::getMimeType怎么用?PHP Utilities::getMimeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities
的用法示例。
在下文中一共展示了Utilities::getMimeType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
public function __call($name, $arguments)
{
$file = '';
foreach ($arguments as $key => $argument) {
if (empty($argument)) {
unset($arguments[$key]);
continue;
}
if (!is_array($argument)) {
continue;
}
if (isset($argument['folder'])) {
$file .= $argument['folder'];
unset($arguments[$key]);
}
}
if (!empty($arguments)) {
$filename = array(implode('.', $arguments), $name, self::FILE_EXTENSION);
} else {
$filename = array($name, self::FILE_EXTENSION);
}
$file .= '/' . implode('.', $filename);
if (file_exists(CONTRIB_PATH . self::FOLDER . $file)) {
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Etag: ' . md5(file_get_contents(CONTRIB_PATH . self::FOLDER . $file)));
header('Vary: *');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime(CONTRIB_PATH . self::FOLDER . $file)) . ' GMT');
header('Content-type: ' . Utilities::getMimeType(self::FILE_EXTENSION));
echo file_get_contents(CONTRIB_PATH . self::FOLDER . $file);
exit;
} else {
$this->bye();
}
}
示例2: run
public function run()
{
foreach ($this->_routes as $rule => $conf) {
if (preg_match($conf[0], Utilities::getMimeType($this->_fileExt), $matches)) {
require_once CONTRIB_PATH . '/controller/' . $conf[1] . '.php';
$class = new $conf[1]();
$method = $this->_fileMode;
$class->{$method}($this->_fileName, array('folder' => $this->_folderPath));
}
}
}
示例3: outputContent
protected function outputContent($content, $lastmodified)
{
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Etag: ' . md5($content));
header('Vary: *');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $lastmodified) . ' GMT');
header('Content-type: ' . Utilities::getMimeType($this->getCompressorType()));
echo $content;
exit;
}