當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FileUtils::buildPath方法代碼示例

本文整理匯總了PHP中FileUtils::buildPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileUtils::buildPath方法的具體用法?PHP FileUtils::buildPath怎麽用?PHP FileUtils::buildPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在FileUtils的用法示例。


在下文中一共展示了FileUtils::buildPath方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: newImageBase64

 public static function newImageBase64($base64)
 {
     $tmpDir = FileUtils::getTmpDir();
     $imageExtension = Utils::getImageExtensionFromBase64($base64);
     $imageName = Utils::getRandomString() . '.' . $imageExtension;
     $path = FileUtils::buildPath($tmpDir, $imageName);
     $base64PrefixLess = Utils::extractBase64($base64);
     FileUtils::createDir($tmpDir);
     chmod($tmpDir, 0777);
     $file = file_put_contents($path, base64_decode($base64PrefixLess));
     chmod($path, 0777);
     if ($file == true) {
         $instance = new ImageEditor($path);
     }
     return $instance;
 }
開發者ID:gingerP,項目名稱:shop,代碼行數:16,代碼來源:ImageEditor.php

示例3: getImages

 public static function getImages($id)
 {
     $pref = new DBPreferencesType();
     $catalogDir = $pref->getPreference(Constants::CATALOG_PATH)[DB::TABLE_PREFERENCES__VALUE];
     $goodsType = new DBGoodsType();
     $good = $goodsType->get($id);
     $goodCode = $good[DB::TABLE_GOODS__KEY_ITEM];
     $images = [];
     if (!is_null($goodCode)) {
         $images = FileUtils::getFilesByPrefixByDescription(FileUtils::buildPath($catalogDir, $goodCode), Constants::SMALL_IMAGE, "jpg");
         //$filesMedium = FileUtils::getFilesByPrefixByDescription(Constants::DEFAULT_ROOT_CATALOG_PATH.DIRECTORY_SEPARATOR.$goodCode.DIRECTORY_SEPARATOR, Constants::MEDIUM_IMAGE, "jpg");
     }
     return $images;
 }
開發者ID:gingerP,項目名稱:shop,代碼行數:14,代碼來源:GoodsService.php

示例4: updatePrices

 public static function updatePrices($data)
 {
     $result = [];
     if (count($data) > 0) {
         $dbPreference = new DBPreferencesType();
         $priceDirectory = $dbPreference->getPreference(Constants::PRICE_DIRECTORY)[DB::TABLE_PREFERENCES__VALUE];
         for ($orderIndex = 0; $orderIndex < count(self::$operationsOrder); $orderIndex++) {
             $currentAction = self::$operationsOrder[$orderIndex];
             foreach ($data as $key => $value) {
                 if ($value['action'] == $currentAction) {
                     $operationRes = false;
                     switch ($currentAction) {
                         case self::PRICE_DEL:
                             $operationRes = unlink(FileUtils::buildPath($priceDirectory, $value['name']));
                             break;
                         case self::PRICE_RENAME:
                             $operationRes = rename(FileUtils::buildPath($priceDirectory, $value['name']), FileUtils::buildPath($priceDirectory, $value['new_name']));
                             break;
                         case self::PRICE_ADD:
                             $operationRes = FileUtils::createFileBase64($value['file'], FileUtils::buildPath($priceDirectory, $value['name']));
                             break;
                     }
                     $result[$key] = $operationRes;
                 }
             }
         }
     }
     return $result;
 }
開發者ID:gingerP,項目名稱:shop,代碼行數:29,代碼來源:PriceService.php


注:本文中的FileUtils::buildPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。