當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。