当前位置: 首页>>代码示例>>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;未经允许,请勿转载。