本文整理汇总了PHP中Utilities::getExtension方法的典型用法代码示例。如果您正苦于以下问题:PHP Utilities::getExtension方法的具体用法?PHP Utilities::getExtension怎么用?PHP Utilities::getExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Utilities
的用法示例。
在下文中一共展示了Utilities::getExtension方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testFileExtensions
public function testFileExtensions()
{
$this->assertEquals('html', Utilities::getFileExtension('/some/dir/test.html'));
$this->assertEquals('html', Utilities::getFileExtension('test.html'));
$this->assertEquals('html', Utilities::getFileExtension('.html'));
$this->assertEquals('html', Utilities::getFileExtension('html'));
$this->assertEquals('php', Utilities::getFileExtension('test.html.php'));
$exts = array('htm' => array('text/html', 'html'), 'css' => array('text/css', 'css'), 'html' => array('text/html', 'html'), 'js' => array('application/javascript', 'js'), 'json' => array('application/json', 'json'), 'rss' => array('application/rss+xml', 'rss'), 'atom' => array('application/atom+xml', 'atom'), 'xhtml' => array('application/xhtml+xml', 'xhtml'), 'xml' => array('application/xml', 'xml'), 'jpg' => array('image/jpeg', 'jpeg'), 'gif' => array('image/gif', 'gif'), 'jpeg' => array('image/jpeg', 'jpeg'), 'png' => array('image/png', 'png'), 'txt' => array('text/plain', 'txt'), 'unknown' => array('text/plain', 'txt'));
foreach ($exts as $ext => $a) {
list($mime, $ext2) = $a;
$actualMime = Utilities::getContentType($ext);
$this->assertEquals($mime, $actualMime);
$this->assertEquals($ext2, Utilities::getExtension($actualMime));
}
$this->assertEquals(null, Utilities::getExtension('text/unknown'));
}
示例2: loadHelpers
function loadHelpers($type)
{
if ($type === 'all') {
$files = scandir($this->quantum_root . 'system/helpers/');
//var_dump($files);
foreach ($files as $file) {
if (Utilities::getExtension($file) == 'php') {
include_once $this->quantum_root . 'system/helpers/' . $file;
}
}
return true;
} else {
$file = $type;
include_once $this->quantum_root . 'app/helpers/' . $file;
return true;
}
}