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


PHP FileUtils::createFolderRecursive方法代碼示例

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


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

示例1: ensureImageDirIsAvailable

 public function ensureImageDirIsAvailable($row_id)
 {
     $image_dir = $this->getImageDir($row_id);
     if ($image_dir !== false) {
         if (!file_exists($image_dir)) {
             FileUtils::createFolderRecursive($image_dir);
         }
     }
 }
開發者ID:pixelproduction,項目名稱:PixelManagerCMS,代碼行數:9,代碼來源:DataTable.php

示例2: setData

 public function setData($id, $data)
 {
     if ($data === null) {
         return false;
     }
     $properties = $this->getProperties($id);
     if ($properties === false) {
         return false;
     }
     $folder = $this->getPageEditFolder($id, $properties);
     $url = $this->getPageFilesEditUrl($id, $properties);
     if (!is_dir($folder)) {
         $published_folder = $this->getPagePublishedFolder($id, $properties);
         if (is_dir($published_folder)) {
             if (!FileUtils::copyFolder($published_folder, $folder)) {
                 return false;
             }
         } else {
             if (!FileUtils::createFolderRecursive($folder)) {
                 return false;
             }
         }
     }
     $page_files_folder = $folder . self::PAGE_FILES_FOLDER_NAME;
     $page_files_url = $url;
     if (!file_exists($page_files_folder)) {
         FileUtils::createFolderRecursive($page_files_folder);
     }
     $decoded_data = json_decode($data, true);
     $parameters = array('pageId' => $id, 'pageFiles' => $page_files_folder . '/', 'pageFilesUrl' => $page_files_url . '/');
     Plugins::call(Plugins::BEFORE_SAVE_PAGE_DATA_FIELDS, $parameters, $decoded_data);
     $this->applyPluginsToDataFields(Plugins::SAVE_PAGE_DATA_FIELD, $parameters, $decoded_data, $properties);
     Plugins::call(Plugins::AFTER_SAVE_PAGE_DATA_FIELDS, $parameters, $decoded_data);
     $encoded_data = json_encode($decoded_data);
     $file = $folder . self::DATA_FILE_NAME;
     if (!FileUtils::createFile($file)) {
         return false;
     }
     if (@file_put_contents($file, $encoded_data) === false) {
         return false;
     }
     if ($properties['status'] == self::STATUS_PUBLISHED) {
         $new_properties = array('status' => self::STATUS_EDIT);
         $this->setProperties($id, $new_properties);
     }
     return true;
 }
開發者ID:pixelproduction,項目名稱:PixelManagerCMS,代碼行數:47,代碼來源:Pages.php


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