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


PHP FileManager::write方法代码示例

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


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

示例1: testScan

 public function testScan()
 {
     $content = 'test';
     $path = __DIR__ . '/test/';
     $filePath = $path . 'test.txt';
     $this->manager->write($filePath, $content);
     $this->assertEquals($filePath, $this->manager->scan([$path], ['txt'], [__DIR__ . '/folder/'])[0]);
 }
开发者ID:samsonframework,项目名称:localfilemanager,代码行数:8,代码来源:LocalFileManagerTest.php

示例2: write

 /**
  * Writes schema file from object or options.
  *
  * @param array|object $object Schema object or options array.
  * @param array $options Schema object properties to override object.
  * @return mixed False or string written to file.
  */
 public function write($object, $options = array())
 {
     if (is_object($object)) {
         $object = get_object_vars($object);
         $this->build($object);
     }
     if (is_array($object)) {
         $options = $object;
         unset($object);
     }
     extract(array_merge(get_object_vars($this), $options));
     $out = "class {$name}Schema extends CakeSchema {\n\n";
     if ($path !== $this->path) {
         $out .= "\tpublic \$path = '{$path}';\n\n";
     }
     if ($file !== $this->file) {
         $out .= "\tpublic \$file = '{$file}';\n\n";
     }
     if ($connection !== 'default') {
         $out .= "\tpublic \$connection = '{$connection}';\n\n";
     }
     $out .= "\tpublic function before(\$event = array()) {\n\t\treturn true;\n\t}\n\n\tpublic function after(\$event = array()) {\n\t}\n\n";
     if (empty($tables)) {
         $this->read();
     }
     foreach ($tables as $table => $fields) {
         if (!is_numeric($table) && $table !== 'missing') {
             $out .= $this->generateTable($table, $fields);
         }
     }
     $out .= "}\n";
     $file = new FileManager($path . DS . $file, true);
     $content = "<?php \n{$out}";
     if ($file->write($content)) {
         return $content;
     }
     return false;
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:45,代码来源:CakeSchema.php

示例3:

<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//include whois class
include __DIR__ . '\\src\\FileManager.php';
$fileManager = new \FileManager();
$path = '/home/username/somedir/file.txt';
// or
// $path = 'C:\hello\test.txt';
$content = 'blablabla';
$result = $fileManager->write($path, $content);
var_dump($result);
开发者ID:boltegg,项目名称:file-manager,代码行数:16,代码来源:example.php


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