• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP FileUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testRandomFromFolderWithFoldersNoMtime

 function testRandomFromFolderWithFoldersNoMtime()
 {
     $count = 0;
     $another_count = 0;
     $css_count = 0;
     $ext_count = 0;
     $test_count = 0;
     for ($i = 0; $i < 30; $i++) {
         $result = FileUtils::randomFromFolder("/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/", false, true);
         $this->assertNotNull($result);
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/another_dir/") {
             $another_count += 1;
         }
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/css_test.css") {
             $css_count += 1;
         }
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/ext_test.plug.txt") {
             $ext_count += 1;
         }
         if ($result == "/" . FRAMEWORK_CORE_PATH . "tests/io/test_dir/content_dir/test_file.txt") {
             $test_count += 1;
         }
         $sum = $another_count + $css_count + $ext_count + $test_count;
         $this->assertTrue($count == $sum - 1);
         $count += 1;
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:27,代码来源:file_utils_test.php


示例2: after_create

 public function after_create()
 {
     UserMailer::deliver_new_user($this->email, $this);
     $path = FileUtils::join(NIMBLE_ROOT, 'get', $this->username);
     FileUtils::mkdir_p($path);
     chmod($path, 0755);
 }
开发者ID:xetorthio,项目名称:pearfarm_channel_server,代码行数:7,代码来源:user.php


示例3: clearCacheDir

 protected static function clearCacheDir($path)
 {
     if (is_dir($path)) {
         return FileUtils::rrmdir($path);
     }
     return true;
 }
开发者ID:Athorcis,项目名称:athorrent-frontend,代码行数:7,代码来源:CacheUtils.php


示例4: loadDir

 public static function loadDir($path)
 {
     $files = FileUtils::getFilesForDirectory($path);
     foreach ($files as $file) {
         self::loadFile($path . DIRECTORY_SEPARATOR . $file);
     }
 }
开发者ID:amptools-net,项目名称:midori-php,代码行数:7,代码来源:Tab.php


示例5: __construct

 protected function __construct()
 {
     $this->array = ArrayUtils::instance();
     $this->file = FileUtils::instance();
     $this->object = ObjectUtils::instance();
     $this->string = StringUtils::instance();
 }
开发者ID:patxi1980,项目名称:utilities,代码行数:7,代码来源:Utils.php


示例6: uploadWare

 function uploadWare($file, $fields)
 {
     $rs = FileUtils::UpWare($file, true);
     if ($rs != false) {
         $fields['title'] = $rs;
     }
     $this->_dbmaterials->create($fields);
 }
开发者ID:ChenXL581X,项目名称:distributedcourse,代码行数:8,代码来源:MaterialsOperation.php


示例7: _deleteTempAvatarFiles

 private function _deleteTempAvatarFiles($uid)
 {
     $files = $this->_getTempAvatarFiles($uid);
     $path = UploadUtils::getTempAvatarPath();
     foreach ($files as $fileName) {
         FileUtils::safeDeleteFile($path . '/' . $fileName);
     }
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:8,代码来源:SaveAvatarAction.php


示例8: __destruct

 public function __destruct()
 {
     try {
         FileUtils::removeDirectory($this->path, true);
     } catch (BaseException $e) {
         // boo! deal with garbage yourself.
     }
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:8,代码来源:TempDirectory.class.php


示例9: getItemsTable

 public function getItemsTable($pageNumber, $num, $response, $key, $valueToSearch)
 {
     $mainTag = new Div();
     $tdNum = 3;
     $tdNumTotal = $tdNum * 2 - 1;
     $indOnPage = 0;
     $items = 0;
     $td = 0;
     $item = new Item();
     $rowIndex = 1;
     $tdHeight = Utils::isSquareViewMode() ? 300 : 30;
     $highLightId = Utils::getFromGET(UrlParameters::HIGH_LIGHT_ELEMENT);
     $isMetro = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "metro" || !array_key_exists(UrlParameters::VIEW_MODE, $_GET);
     $isCompact = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "compact";
     $isExtend = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "extend";
     $isList = array_key_exists(UrlParameters::VIEW_MODE, $_GET) && Utils::getFromGET(UrlParameters::VIEW_MODE) == "list";
     $rowViewClass = $isCompact ? 'compact' : ($isMetro ? "metro" : ($isExtend ? "extend" : ($isList ? "list" : "list")));
     if ($response != 0) {
         $mainTag->addStyleClass("items_table");
         $rowView = new Div();
         $mainTag->addChild($rowView);
         while ($row = mysql_fetch_array($response)) {
             $items++;
             $indOnPage++;
             $td++;
             if (ceil(fmod($indOnPage, $tdNum)) == 1) {
                 $rowIndex++;
                 $indOnPage = 1;
                 $td = 1;
             } elseif (Utils::isEven($td)) {
                 $td++;
             }
             $rowView->addStyleClass($rowViewClass);
             $cellView = new Div();
             $rowView->addChild($cellView);
             $keyItem = $row["key_item"];
             $images = FileUtils::getFilesByPrefixByDescription(Constants::DEFAULT_ROOT_CATALOG_PATH . DIRECTORY_SEPARATOR . $keyItem . DIRECTORY_SEPARATOR, Constants::MEDIUM_IMAGE, 'jpg');
             if (count($images) == 0) {
                 $capImage = FileUtils::getCapImage(Labels::CAP_IMAGE_FOR_CLOTHING);
                 $images = [$capImage];
             }
             $item = null;
             if ($isMetro) {
                 $item = Item::getMetroItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             } elseif ($isCompact) {
                 //$name, $images, $itemId, $pageNumber, $num, $key, $valueToSearch, $type, $trimName, $isHighLightElement
                 $item = Item::getCompactItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             } elseif ($isExtend) {
                 $item = Item::getSquareItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::formatClotheTitle($row["name"]));
             } elseif ($isList) {
                 $item = Item::getLineItemView($row["name"], $images, $row["key_item"], $pageNumber, $num, $key, $valueToSearch, $row['god_type'], Utils::trimFormatClotheTitle($row["name"]), $highLightId == $row["key_item"]);
             }
             $cellView->addChild($item);
             $cellView->addStyleClass("catalog_good_item");
         }
     }
     return $mainTag;
 }
开发者ID:gingerP,项目名称:shop,代码行数:58,代码来源:Items.php


示例10: clearOldFiles

function clearOldFiles()
{
    $files = FileUtils::getFiles("../tmpworksheets");
    foreach ($files as $fName) {
        if (filectime($fName) < time() - 1 * 60 * 60) {
            unlink($fName);
        }
    }
}
开发者ID:rivetweb,项目名称:old-yellowpages-grabber,代码行数:9,代码来源:HandleExportData.php


示例11: setUp

 public function setUp()
 {
     $dir = dirname(__FILE__);
     $this->nimble = Nimble::getINstance();
     Nimble::set_config('stylesheet_folder', FileUtils::join($dir, 'assets', 'stylesheets'));
     Nimble::set_config('stylesheet_folder_url', '/stylesheet');
     Nimble::set_config('javascript_folder', FileUtils::join($dir, 'assets', 'javascript'));
     Nimble::set_config('javascript_folder_url', '/javascript');
 }
开发者ID:scottdavis,项目名称:nimblize,代码行数:9,代码来源:TagHelperTest.php


示例12: about

 public function about()
 {
     $this->set_default_side_bar();
     require_once FileUtils::join(NIMBLE_ROOT, 'lib', 'markdown.php');
     $template = FileUtils::join(NIMBLE_ROOT, 'app', 'view', 'help', 'about.markdown');
     $this->about = file_get_contents($template);
     $this->title = 'About Pearfarm';
     Nimble::set_title($this->title);
 }
开发者ID:xetorthio,项目名称:pearfarm_channel_server,代码行数:9,代码来源:help_controller.php


示例13: saveBookletImage

 private static function saveBookletImage($bookletCode, $imageName, $base64Image)
 {
     $bookletImagesRoot = DBPreferencesType::getPreferenceS(Constants::BOOKLET_IMAGE_PATH);
     $bookletImageDirectory = FileUtils::buildPath($bookletImagesRoot, $bookletCode);
     FileUtils::createDir($bookletImageDirectory);
     $imageEditor = ImageEditor::newImageBase64($base64Image);
     $bookletImagePath = FileUtils::buildPath($bookletImagesRoot, $bookletCode, $imageName);
     $imageEditor->saveImage($bookletImagePath);
     return FileUtils::buildPath($bookletCode, $imageName);
 }
开发者ID:gingerP,项目名称:shop,代码行数:10,代码来源:BookletService.php


示例14: parse

 public static function parse(DOMNode $node)
 {
     if ($node->nodeName == self::getNodeName()) {
         if (($code = HTTPCode::getByCode(XMLUtils::getChildByName($node, "code")->nodeValue)) != null) {
             return new Error(FileUtils::getAbsolutePath(XMLUtils::getChildByName($node, "file")->nodeValue, VIEWS_FOLDER), $code);
         }
         throw new Exception("Unknown HTTP Code '" . XMLUtils::getChildByName($node, "code")->nodeValue . "'");
     }
     throw new Exception("Unexpected node '" . $node->nodeName . "', expected '" . self::getNodeName() . "'");
 }
开发者ID:pierrelemee,项目名称:star,代码行数:10,代码来源:Error.php


示例15: testUniqueNames

 public function testUniqueNames()
 {
     $uniqueName = FileUtils::makeUniqueName('Chasey Lain.jpeg');
     $this->assertEquals(substr($uniqueName, strpos($uniqueName, '.')), '.jpeg');
     $uniqueName = FileUtils::makeUniqueName('Елена Беркова.jpeg');
     $this->assertEquals(substr($uniqueName, strpos($uniqueName, '.')), '.jpeg');
     $uniqueName = FileUtils::makeUniqueLatinName('Елена Беркова.gif');
     //animated gif ;)
     $this->assertEquals(substr($uniqueName, strpos($uniqueName, '.')), '.gif');
 }
开发者ID:onphp-framework,项目名称:onphp-framework,代码行数:10,代码来源:FileUtilsTest.class.php


示例16: create_package

 public static function create_package()
 {
     $user = User::find_by_username('bob');
     $file = FileUtils::join(NIMBLE_ROOT, 'test', 'data', 'bobs_other_package-0.0.1.tgz');
     $package = Package::from_upload(array('file' => $file, 'user' => $user));
     foreach (User::_find('all') as $user) {
         $raiting = '0.' . $user->id;
         PackageRating::_create(array('user_id' => $user->id, 'package_id' => $package->id, 'rating' => (double) $raiting));
     }
 }
开发者ID:scottdavis,项目名称:pearfarm_channel_server,代码行数:10,代码来源:story_helper.php


示例17: upfile

 public function upfile($file, $fields)
 {
     $rs = FileUtils::upfile($file, true);
     if ($rs != false) {
         $fields['name'] = $rs;
         $fields['url'] = FileUtils::GetPath() . "/" . $fields['name'];
     }
     $this->insertFile($fields);
     return $fields;
 }
开发者ID:ChenXL581X,项目名称:distributedcourse,代码行数:10,代码来源:TaskOperation.php


示例18: _load

 /**
  * tries to include the requested plugin and returns the plugin class name, or false if plugin not found.
  * @param string $pluginName name of the plugin
  * @return string class name or false if not found
  */
 protected function _load($pluginName, $section)
 {
     $cleanName = FileUtils::sanitize($pluginName);
     $className = strtolower("Plugins_{$cleanName}_{$section}");
     if (M::resolve_class($className, 'plugins', function () use($cleanName) {
         PluginRegistry::initPlugin($cleanName);
     })) {
         return $className;
     }
 }
开发者ID:demental,项目名称:m,代码行数:15,代码来源:PluginRegistry.php


示例19: MoveUploadedFile

 public static function MoveUploadedFile($value, $target, $replaceIfExists = false)
 {
     if ($replaceIfExists) {
         if (FileUtils::IsUploadedFile($value)) {
             if (FileUtils::FileExists($target)) {
                 FileUtils::RemoveFile($target);
             }
         }
     }
     move_uploaded_file($value, $target);
 }
开发者ID:outsourcinggithub,项目名称:outsourcing,代码行数:11,代码来源:file_utils.php


示例20: copyFile

 function copyFile(PhingFile $sourceFile, PhingFile $destFile, $overwrite = false, $preserveLastModified = true, &$filterChains = null, Project $project)
 {
     // writes to tmp file first, then rename it to avoid file locking race
     // conditions
     $parent = $destFile->getParentFile();
     $tmpFile = new PhingFile($parent, substr(md5(time()), 0, 8));
     parent::copyFile($sourceFile, $tmpFile, $overwrite, $preserveLastModified, $filterChains, $project);
     $tmpFile->renameTo($destFile);
 }
开发者ID:hellogerard,项目名称:phing-things,代码行数:9,代码来源:ConsistentCopy.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP FileWriter类代码示例发布时间:2022-05-23
下一篇:
PHP FileUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap