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


PHP FileSystem::putDir方法代码示例

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


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

示例1: write

 public function write($path, $data, $mode)
 {
     import('ORG.Net.FileSystem');
     $paths = new FileSystem();
     $paths->root = ITEM;
     $paths->charset = C('CFG_CHARSET');
     //main
     if ($mode == 'conf') {
         if (!is_writeable(ROOT . '/Conf')) {
             return -1;
         }
         $fp = fopen($path, 'wb');
         flock($fp, 3);
         fwrite($fp, "<" . "?php\r\n");
         fwrite($fp, "return array(\r\n");
         //dump($data);
         foreach ($data as $fval) {
             $fval['vals'] = htmlspecialchars_decode($fval['vals']);
             if ($fval['types'] == 'int' || $fval['types'] == 'bool') {
                 if ($fval['vals'] == "") {
                     $fval['vals'] = 0;
                 }
                 fwrite($fp, "\t'" . $fval['keyword'] . "' => " . addslashes($fval['vals']) . ",\r\n");
             } elseif ($fval['types'] == 'select' || $fval['types'] == 'more') {
                 list($key, $val) = explode('>>', $fval['vals']);
                 if ($key == 'none') {
                     fwrite($fp, "\t'" . $fval['keyword'] . "' => '',\r\n");
                 } else {
                     fwrite($fp, "\t'" . $fval['keyword'] . "' => '" . addslashes($key) . "',\r\n");
                 }
             } else {
                 fwrite($fp, "\t'" . $fval['keyword'] . "' => '" . addslashes($fval['vals']) . "',\r\n");
             }
         }
         fwrite($fp, ");");
         fclose($fp);
         return 1;
     } elseif ($mode && $mode != 'conf') {
         if (!file_exists($path)) {
             $paths->putDir($path);
         }
         if (!is_writeable($path)) {
             return -1;
         }
         $put = $paths->putFile($path . '/' . $mode . '.json', $data);
         return $put;
     } else {
         $this->error('未知操作模式,请检查!');
     }
 }
开发者ID:huangchuping,项目名称:bug,代码行数:50,代码来源:WritePublic.class.php

示例2: downzip

 /**
  * 打包下载备份包
  *@param $file    文件路劲
  *@examlpe 
  */
 public function downzip($file)
 {
     import('ORG.Util.phpzip');
     $addzip = new phpzip();
     import('ORG.Net.FileSystem');
     $path = new FileSystem();
     $path->root = ITEM;
     $path->charset = C('CFG_CHARSET');
     load("@.download");
     //main
     $file = strval($file);
     $realpath = CONF_PATH . 'Backup/' . $file;
     $bakfile = RUNTIME_PATH . 'Temp/Zip/';
     if (!file_exists($bakfile)) {
         $path->putDir($bakfile);
     }
     $zipname = 'Backup_' . $file . '.zip';
     $zippath = $bakfile . $zipname;
     $addzip->zip($realpath, $zippath);
     if (file_exists($zippath)) {
         download($zippath);
         $path->delFile($zippath);
     }
     unset($addzip, $path);
 }
开发者ID:huangchuping,项目名称:bug,代码行数:30,代码来源:BackupAction.class.php


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