本文整理汇总了PHP中FileSystem::touch方法的典型用法代码示例。如果您正苦于以下问题:PHP FileSystem::touch方法的具体用法?PHP FileSystem::touch怎么用?PHP FileSystem::touch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem::touch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stream_metadata
/**
* Change stream options
*/
public function stream_metadata($path, $option, $value)
{
if (!$this->initPath($path)) {
return FALSE;
}
if ($option !== STREAM_META_TOUCH) {
return FALSE;
}
$mtime = isset($value[0]) ? $value[0] : time();
$atime = isset($value[1]) ? $value[1] : $mtime;
return $this->fileSystem->touch($this->getFilename(), $mtime, $atime);
}
示例2: makeFile
/**
* @param Filesystem $filesystem
* @param $baseDir
* @param $fileName
*
* @return string
*/
protected function makeFile(FileSystem $filesystem, $baseDir, $fileName)
{
$fileName = $baseDir . \DIRECTORY_SEPARATOR . $fileName;
$filesystem->touch($fileName);
return $fileName;
}
示例3: ProcessLocker
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\FirePHPHandler;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\ProcessBuilder;
use Symfony\Component\Process\PhpProcess;
use Symfony\Component\Filesystem\Filesystem;
use Helpers\ProcessLocker;
$locker = new ProcessLocker($config['lock_file']);
if ($locker->isLocked()) {
return;
}
$locker->lockProcess();
$logFileName = $config['log_files_path'] . 'report ' . date('d-m-Y H i s') . '.log';
$fs = new FileSystem();
$fs->touch($logFileName);
$logger = new Logger('csv_batch_importer');
$logger->pushHandler(new StreamHandler($logFileName, Logger::DEBUG));
$logger->pushHandler(new FirePHPHandler());
$files = array_filter(scandir($config['output_csv_path']), function ($file_name) {
return preg_match('/^output.*\\.csv$/', $file_name) ? $file_name : null;
});
foreach ($files as $file_name) {
$file_name = $config['output_csv_path'] . $file_name;
$process_builder = new ProcessBuilder(array($config['php_path'], __DIR__ . '/csv_process.php', $file_name), $config['proc_working_path']);
$process_builder->setTimeout(0);
$process_builder->getProcess()->run(function ($type, $buffer) use($logger) {
if (Process::ERR === $type) {
$logger->addError($buffer);
} else {
$logger->addInfo($buffer);