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


PHP File::getContents方法代码示例

本文整理汇总了PHP中Bitrix\Main\IO\File::getContents方法的典型用法代码示例。如果您正苦于以下问题:PHP File::getContents方法的具体用法?PHP File::getContents怎么用?PHP File::getContents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitrix\Main\IO\File的用法示例。


在下文中一共展示了File::getContents方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getSavedData

 /**
  * @return array | null
  */
 private function _getSavedData()
 {
     if (!$this->_file->isExists()) {
         return array();
     }
     return \WS\Migrations\jsonToArray($this->_file->getContents());
 }
开发者ID:ASDAFF,项目名称:bitrix-module-migrations,代码行数:10,代码来源:collector.php

示例2: readStatistic

 /**
  * Returns array with cache statistics data.
  * Returns an empty array in case of disabled html cache.
  *
  * @return array
  */
 public function readStatistic()
 {
     $result = array();
     if ($this->statFile && $this->statFile->isExists()) {
         $fileValues = explode(",", $this->statFile->getContents());
         $result = array("HITS" => intval($fileValues[0]), "MISSES" => intval($fileValues[1]), "QUOTA" => intval($fileValues[2]), "POSTS" => intval($fileValues[3]), "FILE_SIZE" => doubleval($fileValues[4]));
     }
     return $result;
 }
开发者ID:spas-viktor,项目名称:books,代码行数:15,代码来源:statichtmlcache.php

示例3: reindexFile

 private function reindexFile($siteId, $rootPath, $path, $maxFileSize = 0)
 {
     $pathAbs = IO\Path::combine($rootPath, $path);
     if (!UrlRewriter::checkPath($pathAbs)) {
         return 0;
     }
     $file = new IO\File($pathAbs);
     if ($maxFileSize > 0 && $file->getFileSize() > $maxFileSize * 1024) {
         return 0;
     }
     $fileSrc = $file->getContents();
     if (!$fileSrc || $fileSrc == "") {
         return 0;
     }
     $arComponents = \PHPParser::parseScript($fileSrc);
     for ($i = 0, $cnt = count($arComponents); $i < $cnt; $i++) {
         $sef = is_array($arComponents[$i]["DATA"]["PARAMS"]) && $arComponents[$i]["DATA"]["PARAMS"]["SEF_MODE"] == "Y";
         Component\ParametersTable::add(array('SITE_ID' => $siteId, 'COMPONENT_NAME' => $arComponents[$i]["DATA"]["COMPONENT_NAME"], 'TEMPLATE_NAME' => $arComponents[$i]["DATA"]["TEMPLATE_NAME"], 'REAL_PATH' => $path, 'SEF_MODE' => $sef ? Component\ParametersTable::SEF_MODE : Component\ParametersTable::NOT_SEF_MODE, 'SEF_FOLDER' => $sef ? $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] : null, 'START_CHAR' => $arComponents[$i]["START"], 'END_CHAR' => $arComponents[$i]["END"], 'PARAMETERS' => serialize($arComponents[$i]["DATA"]["PARAMS"])));
         if ($sef) {
             if (array_key_exists("SEF_RULE", $arComponents[$i]["DATA"]["PARAMS"])) {
                 $ruleMaker = new UrlRewriterRuleMaker();
                 $ruleMaker->process($arComponents[$i]["DATA"]["PARAMS"]["SEF_RULE"]);
                 $arFields = array("CONDITION" => $ruleMaker->getCondition(), "RULE" => $ruleMaker->getRule(), "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path, "SORT" => self::DEFAULT_SORT);
             } else {
                 $arFields = array("CONDITION" => "#^" . $arComponents[$i]["DATA"]["PARAMS"]["SEF_FOLDER"] . "#", "RULE" => "", "ID" => $arComponents[$i]["DATA"]["COMPONENT_NAME"], "PATH" => $path, "SORT" => self::DEFAULT_SORT);
             }
             UrlRewriter::add($siteId, $arFields);
         }
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:urlrewriter.php

示例4: isset

<?php

/** Bitrix Framework
 * Bitrix vars
 * @global CUser $USER
 * @global CMain $APPLICATION
 */
use Bitrix\Main\IO\File;
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
if ($USER->IsAdmin()) {
    $server = isset($_REQUEST['SERVER']) ? trim($_REQUEST['SERVER']) : false;
    $param = isset($_REQUEST['PARAM']) ? trim($_REQUEST['PARAM']) : false;
    $period = isset($_REQUEST['PERIOD']) ? trim($_REQUEST['PERIOD']) : false;
    if ($server && $period && $param) {
        $pathToImages = "/var/lib/munin";
        $path = $pathToImages . '/' . $server . '/' . $server . '/' . $param . '-' . $period . '.png';
        $f = new File($path);
        if ($f->isExists()) {
            header("Content-type: image/png");
            echo $f->getContents();
        }
    }
}
die;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:24,代码来源:image.php

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