本文整理汇总了PHP中Converter::getFilename方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::getFilename方法的具体用法?PHP Converter::getFilename怎么用?PHP Converter::getFilename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Converter
的用法示例。
在下文中一共展示了Converter::getFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once dirname(__FILE__) . '/../../common.php';
require_once dirname(__FILE__) . '/../../Converter.php';
// -----------------------------------------------------------------------------
define('PATH_BASE', dirname(__FILE__));
//if (isset($_GET['fileName'])){
//$fileName = $_GET['fileName'];
//}
//$inputFilename = PATH_BASE . DIRECTORY_SEPARATOR . $fileName.'.rtf'; // convert this file
//$outputFormat = 'pdf'; // into this format
$inputFilename = PATH_BASE . DIRECTORY_SEPARATOR . $fileName . '.rtf';
// convert this file
$outputFormat = 'pdf';
// -----------------------------------------------------------------------------
$outputFilename = Converter::getFilename($inputFilename, $outputFormat);
//printf('Converting %s to %s... ', basename($inputFilename), basename($outputFilename));
$convertedDocument = Converter::convert($inputFilename, $outputFormat);
if (false !== $convertedDocument) {
file_put_contents($outputFilename, $convertedDocument);
print "DONE.\n";
} else {
print "ERROR.\n";
}
// -----------------------------------------------------------------------------
示例2: strtolower
$outputFormat = strtolower($outputFormat);
if (!in_array($outputFormat, $outputFormats)) {
echo $opts->getUsageMessage();
exit;
}
// -------------------------------------------------------------------------
touch(FILENAME_LOCK);
// -------------------------------------------------------------------------
$path = new DirectoryIterator(PATH_INPUT);
$inputFormats = $phpLiveDocx->getTemplateFormats();
foreach ($path as $file) {
$inputFormat = Tis_Service_LiveDocx::getFormat($file->getFilename());
if (in_array($inputFormat, $inputFormats)) {
$inputFilename = PATH_INPUT . DIRECTORY_SEPARATOR . $file->getFilename();
$inputDoneFilename = PATH_INPUT_DONE . DIRECTORY_SEPARATOR . $file->getFilename();
$outputFilename = PATH_OUTPUT . DIRECTORY_SEPARATOR . Converter::getFilename($file->getFilename(), $outputFormat);
printf('Converting %s to %s... ', basename($inputFilename), basename($outputFilename));
if ($inputFormat === $outputFormat) {
rename($inputFilename, $inputDoneFilename);
print "SKIPPED.\n";
} else {
$convertedDocument = Converter::convert($inputFilename, $outputFormat);
if (false !== $convertedDocument) {
file_put_contents($outputFilename, $convertedDocument);
rename($inputFilename, $inputDoneFilename);
print "DONE.\n";
} else {
print "ERROR.\n";
}
}
}