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


PHP FileHandler::ReadFile方法代码示例

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


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

示例1: getSampleInput

 /**
  * Gets the sample input from the filesystem.
  *
  * @param Request $r
  * @throws InvalidFilesystemOperationException
  */
 public static function getSampleInput(Request $r)
 {
     $source_path = PROBLEMS_PATH . DIRECTORY_SEPARATOR . $r['problem']->getAlias() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . 'sample.in';
     try {
         $file_content = FileHandler::ReadFile($source_path);
     } catch (Exception $e) {
         // Most problems won't have a sample input.
         $file_content = '';
     }
     return $file_content;
 }
开发者ID:andreasantillana,项目名称:omegaup,代码行数:17,代码来源:ProblemController.php

示例2: handleStatements

 /**
  * Read already deployed statements from filesystem and apply transformations
  * $lang.markdown => statements/$lang.html as well as encoding checks
  *
  * @param string $dirpath
  * @param array $filesToUnzip
  */
 private function handleStatements(array $filesToUnzip = null)
 {
     // Get a list of all available statements.
     // At this point, zip is validated and it has at least 1 statement. No need to check
     $statements = preg_grep('/^statements\\/[a-zA-Z]{2}\\.markdown$/', $filesToUnzip);
     $this->log->info('Handling statements...');
     // Transform statements from markdown to HTML
     foreach ($statements as $statement) {
         // Get the path to the markdown unzipped file
         $markdown_filepath = "{$this->tmpDir}/{$statement}";
         $this->log->info('Reading file ' . $markdown_filepath);
         // Read the contents of the original markdown file
         $this->current_markdown_file_contents = FileHandler::ReadFile($markdown_filepath);
         // Deploy statement raw (.markdown) and transformed (.html)
         $this->HTMLizeStatement($this->tmpDir, basename($statement));
         $this->updatedLanguages[] = basename($statement, '.markdown');
     }
 }
开发者ID:RicardoMelgoza,项目名称:omegaup,代码行数:25,代码来源:ProblemDeployer.php


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