本文整理匯總了PHP中f::mime方法的典型用法代碼示例。如果您正苦於以下問題:PHP f::mime方法的具體用法?PHP f::mime怎麽用?PHP f::mime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類f
的用法示例。
在下文中一共展示了f::mime方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: to
public function to()
{
if (!is_null($this->to)) {
return $this->to;
}
$source = $this->source();
$name = f::name($source['name']);
$extension = f::extension($source['name']);
$safeName = f::safeName($name);
$safeExtension = str_replace('jpeg', 'jpg', str::lower($extension));
if (empty($safeExtension)) {
$safeExtension = f::mimeToExtension(f::mime($source['tmp_name']));
}
return $this->to = str::template($this->options['to'], array('name' => $name, 'filename' => $source['name'], 'safeName' => $safeName, 'safeFilename' => $safeName . r(!empty($safeExtension), '.' . $safeExtension), 'extension' => $extension, 'safeExtension' => $safeExtension));
}
示例2: mime
/**
* Returns the mime type of a file
*
* @return string
*/
public function mime()
{
return f::mime($this->root);
}
示例3: download
public static function download($file, $name = null)
{
// stop the download if the file does not exist or is not readable
if (!is_file($file) or !is_readable($file)) {
return false;
}
header::download(array('name' => $name ? $name : f::filename($file), 'size' => f::size($file), 'mime' => f::mime($file), 'modified' => f::modified($file)));
die(f::read($file));
}
示例4: testMime
public function testMime()
{
$this->assertEquals('text/plain', f::mime($this->contentFile));
}