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


PHP FileUtil::setContents方法代码示例

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


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

示例1: set_contents

 public function set_contents()
 {
     $data = 'Test';
     $f = new Stream();
     $this->assertEquals(strlen($data), FileUtil::setContents($f, $data), 'bytes written equals');
     $this->assertEquals($data, FileUtil::getContents($f));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:7,代码来源:FileUtilTest.class.php

示例2: setUp

 public function setUp()
 {
     $tempDir = realpath(System::tempDir());
     $this->fixture = new FilesystemPropertySource($tempDir);
     // Create a temporary ini file
     $this->tempFile = new File($tempDir, 'temp.ini');
     FileUtil::setContents($this->tempFile, "[section]\nkey=value\n");
 }
开发者ID:xp-framework,项目名称:core,代码行数:8,代码来源:FilesystemPropertySourceTest.class.php

示例3: setUp

 /**
  * Sets up test case - creates temporary file
  *
  * @return void
  */
 public function setUp()
 {
     try {
         $this->file = new TempFile();
         FileUtil::setContents($this->file, 'Created by FileInputStreamTest');
     } catch (IOException $e) {
         throw new PrerequisitesNotMetError('Cannot write temporary file', $e, [$this->file]);
     }
 }
开发者ID:xp-framework,项目名称:core,代码行数:14,代码来源:FileInputStreamTest.class.php

示例4: perform

 /**
  * Execute action
  *
  * @return  int
  */
 public function perform()
 {
     $this->archive->open(ARCHIVE_READ);
     $args = $this->getArguments();
     while ($entry = $this->archive->getEntry()) {
         if (!$this->_filter($entry, $args)) {
             continue;
         }
         $f = new File($entry);
         $data = $this->archive->extract($entry);
         if (!($this->options & Options::SIMULATE)) {
             // Create folder on demand. Note that inside a XAR, the directory
             // separator is *ALWAYS* a forward slash, so we need to change
             // it to whatever the OS we're currently running on uses.
             $dir = new Folder(str_replace('/', DIRECTORY_SEPARATOR, dirname($entry)));
             if (!$dir->exists()) {
                 $dir->create();
             }
             FileUtil::setContents($f, $data);
         }
         $this->options & Options::VERBOSE && $this->out->writeLinef('%10s %s', number_format(strlen($data), 0, FALSE, '.'), $entry);
     }
     $this->archive->close();
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:29,代码来源:ExtractInstruction.class.php

示例5: store

 /**
  * Store data
  *
  * @param   string name
  * @param   string data
  */
 protected function store($name, $data, $overwrite = TRUE)
 {
     $file = new File($this->path, $name);
     mkdir($file->getPath(), 0755, true);
     FileUtil::setContents($file, $data);
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:12,代码来源:FileSystemOutput.class.php

示例6: set_contents_writes_bytes

 public function set_contents_writes_bytes()
 {
     $out = new MemoryOutputStream();
     FileUtil::setContents(new File(Streams::writeableFd($out)), 'Test');
     $this->assertEquals('Test', $out->getBytes());
 }
开发者ID:xp-framework,项目名称:core,代码行数:6,代码来源:FileUtilTest.class.php

示例7: readMalformedDataBC

 public function readMalformedDataBC()
 {
     $s = new Stream();
     FileUtil::setContents($s, '@@MALFORMED@@');
     Image::loadFrom(new StreamReader(ref($s)));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:6,代码来源:ImageReaderTest.class.php

示例8: store

 /**
  * Store data
  *
  * @param   string name
  * @param   string data
  */
 protected function store($name, $data)
 {
     FileUtil::setContents(new File($this->path, $name), $data);
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:10,代码来源:FileSystemStorage.class.php


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