本文整理汇总了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;
}
示例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');
}
}