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


PHP Filesystem::write方法代码示例

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


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

示例1: write

 /**
  * Write content into file. If file exists it will be overwritten.
  *
  * @param $path
  * @param $contents
  */
 public function write($path, $contents)
 {
     if ($this->filesystem->has($path)) {
         $this->remove($path);
     }
     $this->filesystem->write($path, $contents);
 }
开发者ID:karion,项目名称:mydrinks,代码行数:13,代码来源:FlySystemAdapter.php

示例2: write

 protected function write($data)
 {
     $destination = $this->composer->getClassPath($this->data['name']);
     if ($this->force && $this->external->has($destination)) {
         $this->external->delete($destination);
     }
     return $this->external->write($destination, $data);
 }
开发者ID:clarkeash,项目名称:machine,代码行数:8,代码来源:BaseGenerator.php

示例3: installParts

 protected function installParts()
 {
     $config = new \stdClass();
     foreach ($this->parts as $part) {
         $part->setupPackage($config, $this->filesystem);
     }
     $this->filesystem->write('composer.json', json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
 }
开发者ID:sethathay,项目名称:PPBakery,代码行数:8,代码来源:SkeletonCreator.php

示例4: loadFile

 /**
  * @return false|string
  */
 private function loadFile()
 {
     if (!$this->filesystem->has($this->getFile())) {
         $this->filesystem->write($this->getFile(), '');
     }
     if (!$this->sites) {
         $this->sites = $this->filesystem->read($this->file);
     }
     return $this->sites;
 }
开发者ID:bramdevries,项目名称:forge-cli,代码行数:13,代码来源:FileLoader.php

示例5: publish

 /**
  * @param File $file
  * @param Version $version
  * @param VersionProvider $versionProvider
  * @param Linker $linker
  * @return bool
  */
 public function publish(File $file, Version $version, VersionProvider $versionProvider, Linker $linker)
 {
     $path = $linker->getLink($file, $version, $versionProvider->getExtension($file, $version));
     $tmp = $this->storage->retrieveVersion($versionProvider->getApplicableVersionable($file), $version);
     if ($this->filesystem->has($path)) {
         return false;
     }
     $this->filesystem->write($path, file_get_contents($tmp), ['visibility' => AdapterInterface::VISIBILITY_PUBLIC]);
     return true;
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:17,代码来源:FlysystemPublisherAdapter.php

示例6: publish

 /**
  * @param string $content
  * @param string $path
  * @return bool
  * @throws \InvalidArgumentException
  * @throws \League\Flysystem\FileNotFoundException
  */
 public function publish($content, $path = '')
 {
     if (empty($path)) {
         throw new \InvalidArgumentException('Path is mandatory!');
     }
     $config = new Config();
     try {
         return $this->storage->write($path, $content, $config);
     } catch (FileExistsException $e) {
         return $this->storage->update($path, $content, $config);
     }
 }
开发者ID:mespinosaz,项目名称:data-publisher,代码行数:19,代码来源:Filesystem.php

示例7: convert

 public function convert($filePathIn, $filePathOut)
 {
     $replace = [];
     $replace['js_app'] = file_get_contents(__DIR__ . "/../../templates/{$this->usedTemplate}/" . "{$this->usedTemplate}.js");
     $replace['js_bootstrap'] = file_get_contents(self::PATH_DIST_BOOTSTRAP_JS);
     $replace['css_app'] = file_get_contents(__DIR__ . "/../../templates/{$this->usedTemplate}/" . "{$this->usedTemplate}.css");
     $replace['css_bootstrap'] = file_get_contents(self::PATH_DIST_BOOTSTRAP_CSS);
     $replace['content'] = $this->mdParser->parse(file_get_contents($filePathIn));
     $output['html'] = $this->latte->renderToString(__DIR__ . "/../../templates/{$this->usedTemplate}/" . "{$this->usedTemplate}.latte", $replace);
     $output['pdf'] = "@todo :)";
     $this->fs->write("{$filePathOut}.html", $output['html']);
     $this->fs->write("{$filePathOut}.pdf", $output['pdf']);
 }
开发者ID:onedal88,项目名称:mdox,代码行数:13,代码来源:Engine.php

示例8: writeToFile

 /**
  * @return bool
  */
 private function writeToFile()
 {
     $this->filesystem->write($this->file, $this->template);
     $this->out->writeln("Written endpoint wrapper to :" . $this->filesystem->get($this->file)->getPath());
     $this->out->writeln("Class " . $this->className . " is generated");
     return $this;
 }
开发者ID:ValentinGot,项目名称:trakt-api-wrapper,代码行数:10,代码来源:EndpointGenerator.php

示例9: run

    public function run()
    {
        $log = new Stream('php://stdout');
        /** @var Config $config */
        $config = Di::getDefault()->getShared('config');
        $expireDate = new DateTime('now', new DateTimeZone('UTC'));
        $expireDate->modify('+1 month');
        $baseUrl = rtrim($config->get('site')->url, '/');
        $content = <<<EOL
User-agent: *
Allow: /
Sitemap: {$baseUrl}/sitemap.xml
EOL;
        $adapter = new Local(dirname(dirname(__FILE__)) . '/public');
        $filesystem = new Filesystem($adapter);
        if ($filesystem->has('robots.txt')) {
            $result = $filesystem->update('robots.txt', $content);
        } else {
            $result = $filesystem->write('robots.txt', $content);
        }
        if ($result) {
            $log->info('The robots.txt was successfully updated');
        } else {
            $log->error('Failed to update the robots.txt file');
        }
    }
开发者ID:phalcon,项目名称:forum,代码行数:26,代码来源:gen-robots.php

示例10: write

 public function write($path, $contents, array $config = [])
 {
     if (parent::write($path, $contents, $config)) {
         return $this->getAdapter()->getModel();
     } else {
         return false;
     }
 }
开发者ID:garrinar,项目名称:laravel,代码行数:8,代码来源:Filesystem.php

示例11: write

 /**
  * Write a new file.
  *
  * @param string $path     The path of the new file.
  * @param string $contents The file contents.
  * @param array  $config   An optional configuration array.
  *
  * @throws FileExistsException
  *
  * @return bool True on success, false on failure.
  */
 public function write($path, $contents, array $config = [])
 {
     $result = parent::write($path, $contents, $config);
     if ($result && ($resource = $this->get($path))) {
         return $this->dispatch(new SyncFile($resource));
     }
     return $result;
 }
开发者ID:ramcda,项目名称:files-module,代码行数:19,代码来源:AdapterFilesystem.php

示例12: writeFile

 /**
  * Write a new file from File.
  *
  * @param File $file File object
  *
  * @throws FileExistsException
  *
  * @return bool True on success, false on failure.
  */
 public function writeFile(File $file)
 {
     try {
         return $this->filesystem->write($file->getDirectories() . $file->getFileName(), $file->getResource(), []);
     } catch (FlysystemFileExistsException $e) {
         FileExistsException::fileExists();
     }
 }
开发者ID:da-vinci-studio,项目名称:file-bundle,代码行数:17,代码来源:Local.php

示例13: _mkfile

 /**
  * @inheritdoc
  */
 protected function _mkfile($path, $name)
 {
     $path = $this->_joinPath($path, $name);
     if ($this->fs->write($path, '')) {
         return $path;
     }
     return false;
 }
开发者ID:manyoubaby123,项目名称:imshop,代码行数:11,代码来源:FlysystemDriver.php

示例14: copyTo

 protected function copyTo($file, Filesystem $target, $targetName = null, Closure $handler = null)
 {
     $targetName = $targetName ?: basename($file);
     $content = file_get_contents($file);
     if ($handler) {
         $content = $handler($content);
     }
     $target->write($targetName, $content);
 }
开发者ID:sethathay,项目名称:PPBakery,代码行数:9,代码来源:AbstractPart.php

示例15: writeSkipSeries

 /**
  * Create skip file to lessons
  */
 public function writeSkipSeries()
 {
     $file = SERIES_FOLDER . '/.skip';
     $series = serialize($this->getSeries());
     if ($this->system->has($file)) {
         $this->system->delete($file);
     }
     $this->system->write($file, $series);
 }
开发者ID:HarryBosh,项目名称:laracasts-downloader,代码行数:12,代码来源:Controller.php


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