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


PHP main::mkdir方法代碼示例

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


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

示例1: s3

 private function s3()
 {
     $amazon_option = get_option(PREFIX_AS3B . 'setting');
     if ($amazon_option) {
         require_once main::getPluginDir() . '/libs/classes/aws-autoloader.php';
         try {
             $dir = BACKUP_DIR . '/' . $this->params['name'];
             $credentials = new Aws\Common\Credentials\Credentials($amazon_option['access_key_id'], $amazon_option['secret_access_key']);
             $client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
             main::log(lang::get("Get Files for Resore Backup", false));
             $keys = $client->listObjects(array('Bucket' => $amazon_option['bucket'], 'Prefix' => $this->params['name']))->getIterator();
             //->getPath('Contents/*/Key');
             if (isset($keys['Contents'])) {
                 $n = count($keys['Contents']);
                 main::mkdir($dir);
                 main::log(lang::get("Start Download files with Amazon S3", false));
                 for ($i = 0; $i < $n; $i++) {
                     $path = explode("/", $keys['Contents'][$i]['Key']);
                     if (isset($path[0]) && isset($path[1]) && !empty($path[1])) {
                         $result = $client->getObject(array('Bucket' => $amazon_option['bucket'], 'Key' => $keys['Contents'][$i]['Key'], 'SaveAs' => BACKUP_DIR . '/' . $keys['Contents'][$i]['Key']));
                         main::log(str_replace("%s", $keys['Contents'][$i]['Key'], lang::get("Download file - %s", false)));
                     }
                 }
                 main::log(lang::get("End downloads files with Amazon S3", false));
                 $this->local();
                 if (is_dir($dir)) {
                     main::remove($dir);
                 }
             } else {
                 $this->setError(lang::get("Error, in downloads with Amazon S3", false));
             }
         } catch (Exception $e) {
             $this->setError($e->getMessage());
         } catch (S3Exception $e) {
             $this->setError($e->getMessage());
         }
     } else {
         $this->setError(lang::get('Error: Data is not exist for send backup files to Amazon S3. Please type your Data in the Settings form', false));
     }
 }
開發者ID:nikitansk,項目名稱:devschool,代碼行數:40,代碼來源:recover.php


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