當前位置: 首頁>>代碼示例>>PHP>>正文


PHP File::getExtension方法代碼示例

本文整理匯總了PHP中Bitrix\Main\IO\File::getExtension方法的典型用法代碼示例。如果您正苦於以下問題:PHP File::getExtension方法的具體用法?PHP File::getExtension怎麽用?PHP File::getExtension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Bitrix\Main\IO\File的用法示例。


在下文中一共展示了File::getExtension方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getRealPath

 /**
  * Returns script filename by URL
  *
  * @param string $site Site ID.
  * @param string $url URL.
  * @return string|null
  */
 public static function getRealPath($site, $url)
 {
     $docRoot = rtrim(\Bitrix\Main\SiteTable::getDocumentRoot($site), '/');
     $url = str_replace('\\', '/', $url);
     $url = \CHTTP::urnEncode($url);
     $uri = new Web\Uri($url);
     $path = \CHTTP::urnDecode($uri->getPath());
     if (substr($path, -1, 1) == '/') {
         $path .= 'index.php';
     }
     $file = new IO\File($docRoot . $path);
     if ($file->isExists()) {
         return substr($file->getPath(), strlen($docRoot));
     }
     if ($rewriteRules = AdminHelper::getRewriteRules($site)) {
         $pathQuery = \CHTTP::urnDecode($uri->getPathQuery());
         foreach ($rewriteRules as &$item) {
             if (preg_match($item['CONDITION'], $pathQuery)) {
                 $url = empty($item['PATH']) && !empty($item['RULE']) ? preg_replace($item['CONDITION'], $item['RULE'], $pathQuery) : $item['PATH'];
                 $url = \CHTTP::urnEncode($url);
                 $uri = new Web\Uri($url);
                 $path = \CHTTP::urnDecode($uri->getPath());
                 $file = new IO\File($docRoot . $path);
                 if ($file->isExists()) {
                     $pathTmp = str_replace('.', '', strtolower(ltrim($path, '/\\')));
                     $pathTmp7 = substr($pathTmp, 0, 7);
                     if ($pathTmp7 == 'upload/' || $pathTmp7 == 'bitrix/') {
                         continue;
                     }
                     if ($file->getExtension() != 'php') {
                         continue;
                     }
                     return substr($file->getPath(), strlen($docRoot));
                 }
             }
         }
     }
     return null;
 }
開發者ID:webgksupport,項目名稱:alpina,代碼行數:46,代碼來源:adminhelper.php

示例2: installProcess

 /**
  * @param string $path This variable is the path to the file for the installation process.
  * @param null $siteId This variable is the id current site.
  * @throws Main\ArgumentNullException
  * @throws Main\IO\FileNotFoundException
  */
 public static function installProcess($path, $siteId = null)
 {
     if (empty($path)) {
         throw new Main\ArgumentNullException("path");
     }
     if (!Main\Loader::includeModule("bizproc")) {
         return;
     }
     $path = Main\Loader::getDocumentRoot() . $path;
     $iblockType = static::getIBlockType();
     $db = \CIBlockType::GetList(array(), array("=ID" => $iblockType));
     $res = $db->Fetch();
     if (!$res) {
         static::createIBlockType();
     }
     $file = new Main\IO\File($path);
     if ($file->isExists() && $file->getExtension() == "prc") {
         static::import($iblockType, $file->getContents(), $siteId);
     }
 }
開發者ID:DarneoStudio,項目名稱:bitrix,代碼行數:26,代碼來源:importer.php


注:本文中的Bitrix\Main\IO\File::getExtension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。