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


PHP File::makeDirectory方法代碼示例

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


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

示例1: checkDirPermission

 public static function checkDirPermission()
 {
     $dirPath = storage_path('app/' . self::$dir);
     if (!Filesystem::exists($dirPath)) {
         Filesystem::makeDirectory($dirPath, 0774);
     }
 }
開發者ID:faltastic,項目名稱:Syria-On-The-Move,代碼行數:7,代碼來源:File.php

示例2: setImageAttribute

 public function setImageAttribute($value)
 {
     if ($this->image) {
         $this->image->delete();
     }
     if (!is_null($value)) {
         $imageName = last(explode('/', $value));
         $targetDirectory = config('admin.imagesUploadDirectory') . '/slides';
         $toDirectory = public_path($targetDirectory);
         if (!\File::exists($toDirectory)) {
             \File::makeDirectory($toDirectory);
         }
         if (\File::exists($value)) {
             \File::move(public_path($value), $toDirectory . '/' . $imageName);
         }
         $this->attributes['image'] = $targetDirectory . '/' . $imageName;
     }
 }
開發者ID:stcoder,項目名稱:uf-vova,代碼行數:18,代碼來源:Slide.php

示例3: boot

 public static function boot()
 {
     parent::boot();
     static::creating(function ($model) {
         if (!$model->validate()) {
             return false;
         }
         return true;
     });
     static::created(function ($model) {
         $result = \File::makeDirectory(getcwd() . "/uploads/" . $model->name);
         return $result;
     });
     static::updating(function ($model) {
         if (!$model->validate()) {
             return false;
         }
         return true;
     });
 }
開發者ID:dwoodard,項目名稱:IserveU,代碼行數:20,代碼來源:FileCategory.php

示例4: storeCMPicture

 public static function storeCMPicture($img_url)
 {
     // post save
     $post = \App\Post::create(array('user_id' => \Auth::user()->id, 'content' => ''));
     $post->postGroups()->attach(\Auth::user()->postGroups()->first()->id);
     // photo save
     $types = array('_s.', '_m.', '_l.');
     $sizes = array(100, 300, 600);
     $original_file_name = $img_url;
     $file_ext = 'jpg';
     $target_path = base_path() . '/public/imgs/';
     $hashSeed = "post" . $post->id . $original_file_name;
     while (1) {
         $file_name = \Func::getHashedValue($hashSeed);
         if (!\File::exists($target_path . \Func::getImgPath($file_name))) {
             break;
         }
         $hashSeed .= rand();
     }
     $target_path .= \Func::getImgPath($file_name) . '/';
     if (!\File::exists($target_path)) {
         \File::makeDirectory($target_path, 0775, true);
     }
     foreach ($types as $key => $type) {
         $new_name = $file_name . $type . $file_ext;
         $img = \Image::make($img_url);
         $img->resize($sizes[$key], null, function ($constraint) {
             $constraint->aspectRatio();
             $constraint->upsize();
         })->save($target_path . $new_name);
         $img->destroy();
     }
     \App\Photo::create(array('post_id' => $post->id, 'sequence' => 1, 'img_path' => $file_name . '.' . $file_ext));
 }
開發者ID:bbig979,項目名稱:shoppyst,代碼行數:34,代碼來源:Post.php

示例5: getTempPath

 /**
  * Define the internal working path, override this method to define.
  */
 public function getTempPath()
 {
     $path = temp_path() . '/uploads';
     if (!FileHelper::isDirectory($path)) {
         FileHelper::makeDirectory($path, 0777, true, true);
     }
     return $path;
 }
開發者ID:spetross,項目名稱:ugvoice,代碼行數:11,代碼來源:File.php


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