本文整理汇总了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));
}