当前位置: 首页>>代码示例>>PHP>>正文


PHP Utilities::getExtension方法代码示例

本文整理汇总了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'));
 }
开发者ID:jivoo,项目名称:jivoo,代码行数:16,代码来源:UtilitiesTest.php

示例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;
     }
 }
开发者ID:carriercomm,项目名称:quantum2,代码行数:17,代码来源:Controller.php


注:本文中的Utilities::getExtension方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。