当前位置: 首页>>代码示例>>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;未经允许,请勿转载。