当前位置: 首页>>代码示例>>PHP>>正文


PHP File::mkdir方法代码示例

本文整理汇总了PHP中File::mkdir方法的典型用法代码示例。如果您正苦于以下问题:PHP File::mkdir方法的具体用法?PHP File::mkdir怎么用?PHP File::mkdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在File的用法示例。


在下文中一共展示了File::mkdir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post_new_city

 public function post_new_city()
 {
     $rules = array('city' => 'required|unique:photos', 'picture' => 'required');
     $v = Validator::make(Input::all(), $rules);
     if ($v->fails()) {
         return Redirect::to('admin/cityphotos')->with_errors($v)->with_input();
     } else {
         $new_photo = array('city' => ucwords(Input::get('city')));
         $photo = new Photo($new_photo);
         if ($photo->save()) {
             $upload_path = path('public') . Photo::$upload_path_city . $photo->city;
             if (!File::exists($upload_path)) {
                 File::mkdir($upload_path);
             }
             $filename = $photo->city . '.jpg';
             $path_to_file = $upload_path . '/' . $filename;
             $dynamic_path = '/' . Photo::$upload_path_city . $photo->city . '/' . $filename;
             $success = Resizer::open(Input::file('picture'))->resize(1024, 724, 'auto')->save($path_to_file, 75);
             if ($success) {
                 $new_photo = Photo::find($photo->id);
                 $new_photo->location = $dynamic_path;
                 $new_photo->save();
             }
             return Redirect::to('admin/cityphotos')->with('msg', '<div class="alert alert-success"><strong>City foto is geupload!</strong></div>');
         } else {
             return Redirect::to('admin/cityphotos')->with('msg', '<div class="alert alert-error"><strong>Er is iets mis gegaan bij het toevoegen.</strong></div>');
         }
     }
 }
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:29,代码来源:photo.php

示例2: instance

    public static function instance($model, $db = null, $options = [])
    {
        $db = is_null($db) ? SITE_NAME : $db;
        $class = __NAMESPACE__ . '\\Model\\' . ucfirst(Inflector::lower($model));
        $file = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db)) . DS . ucfirst(Inflector::lower($model)) . '.php';
        if (File::exists($file)) {
            require_once $file;
            return new $class();
        }
        if (!class_exists($class)) {
            $code = 'namespace ' . __NAMESPACE__ . '\\Model;' . "\n" . '
    class ' . ucfirst(Inflector::lower($model)) . ' extends \\Thin\\MyOrm
    {
        public $timestamps = false;
        protected $table = "' . Inflector::lower($model) . '";

        public static function boot()
        {
            static::unguard();
        }
    }';
            if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql')) {
                $dir = APPLICATION_PATH . DS . 'models' . DS . 'Mysql';
                File::mkdir($dir);
            }
            if (!is_dir(APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db)))) {
                $dir = APPLICATION_PATH . DS . 'models' . DS . 'Mysql' . DS . ucfirst(Inflector::lower($db));
                File::mkdir($dir);
            }
            File::put($file, '<?php' . "\n" . $code);
            require_once $file;
            return new $class();
        }
    }
开发者ID:schpill,项目名称:standalone,代码行数:34,代码来源:mysql.php

示例3: text

 public static function text($str)
 {
     $config = HTMLPurifier_Config::createDefault();
     $cache_dir = Tiny::getPath('cache') . "/htmlpurifier/";
     if (!file_exists($cache_dir)) {
         File::mkdir($cache_dir);
     }
     $config = HTMLPurifier_Config::createDefault();
     //配置 缓存目录
     $config->set('Cache.SerializerPath', $cache_dir);
     //设置cache目录
     //配置 允许flash
     $config->set('HTML.SafeEmbed', true);
     $config->set('HTML.SafeObject', true);
     $config->set('Output.FlashCompat', true);
     //$config->set('HTML.Allowed', 'p');
     //$config->set('AutoFormat.AutoParagraph', true);
     //$config->set('AutoFormat.RemoveEmpty', true);
     //允许<a>的target属性
     $def = $config->getHTMLDefinition(true);
     $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
     $purifier = new HTMLPurifier($config);
     if (get_magic_quotes_gpc()) {
         $str = stripslashes($str);
         $str = $purifier->purify($str);
         $str = addslashes($str);
     } else {
         $str = $purifier->purify($str);
     }
     return self::sql($str);
 }
开发者ID:sammychan1981,项目名称:quanpin,代码行数:31,代码来源:filter_class.php

示例4: compile

 /**
  * Compile an asset collection.
  *
  * @param  Basset\Collection  $collection
  * @return void
  */
 protected function compile(Collection $collection)
 {
     $force = isset($_SERVER['CLI']['FORCE']);
     // If the compile path does not exist attempt to create it.
     if (!File::exists($this->compilePath)) {
         File::mkdir($this->compilePath);
     }
     $groups = $collection->getAssets();
     if (empty($groups)) {
         echo "The collection '{$collection->getName()}' has no assets to compile.\n";
     }
     foreach ($groups as $group => $assets) {
         $path = $this->compilePath . '/' . $collection->getCompiledName($group);
         // We only compile a collection if a compiled file doesn't exist yet or if a change to one of the assets
         // in the collection is detected by comparing the last modified times.
         if (File::exists($path) and File::modified($path) >= $collection->lastModified($group)) {
             // If the force flag has been set then we'll recompile, otherwise this collection does not need
             // to be changed.
             if (!$force) {
                 echo "The {$group}s for the collection '{$collection->getName()}' do not need to be compiled.\n";
                 continue;
             }
         }
         $compiled = $collection->compile($group);
         echo "Successfully compiled {$collection->getCompiledName($group)}\n";
         File::put($path, $compiled);
     }
 }
开发者ID:jvillasante,项目名称:cubanartjb,代码行数:34,代码来源:compile.php

示例5: log

 private function log()
 {
     if (!$this->output || strlen($this->output) < 1) {
         return false;
     }
     $endTime = time();
     $this->console('//--------');
     $this->console('Time: ' . ($endTime - $this->startTime) . ' sec.');
     $this->console('Start script: ' . $this->startTime);
     $this->console('End script: ' . $endTime);
     $dir = LOG_DIR . DS . 'cron' . DS . Request::get('app') . DS . Request::get('module') . DS;
     $name = Request::get('action') . '.' . time() . '.' . LOG_FILE_EXTENTION;
     File::mkdir($dir);
     $log = new File($dir . $name, true);
     $log->write($this->output);
     $files = array_map(function ($a) {
         return array('file' => $a, 'time' => filemtime($a));
     }, glob($dir . Request::get('action') . '.*.' . LOG_FILE_EXTENTION));
     usort($files, function ($a, $b) {
         if ($a['time'] == $b['time']) {
             return 0;
         }
         return $a['time'] > $b['time'] ? -1 : 1;
     });
     $delete = array_slice($files, 10);
     foreach ($delete as $file) {
         unlink($file['file']);
     }
 }
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:29,代码来源:ActionCli.class.php

示例6: execute

 function execute()
 {
     Load::file('nodatabase.class.php', $this->source_dir);
     File::mkdir(TEMP_DIR . DS . 'nodatabase');
     $noDataBase = new noDataBase();
     $noDataBase->basesDir = TEMP_DIR . DS . 'nodatabase' . DS;
     return $noDataBase;
 }
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:8,代码来源:nodatabase.loader.php

示例7: __construct

 public function __construct($ns = 'core')
 {
     $native = Config::get('dir.ephemere', session_save_path());
     $this->dir = $native . DS . $ns;
     if (!is_dir($this->dir)) {
         File::mkdir($this->dir);
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:ephemere.php

示例8: write_jpg

 public function write_jpg($sec, $output_filename)
 {
     if (!preg_match("/\\.(jpg|jpeg)\$/i", $output_filename)) {
         $output_filename = $output_filename . ".jpg";
     }
     File::mkdir(dirname($output_filename));
     new Command(sprintf("%s -ss %01.3f -i %s -f image2 %s", $this->cmd, $sec, $this->filename, $output_filename));
 }
开发者ID:hisaboh,项目名称:w2t,代码行数:8,代码来源:FFmpeg.php

示例9: mkdir

 /**
  * Create a directory if it doesn't exist. The operation is implicitly recursive, i.e. it will create all
  * intermediate directories if they do not already exist.
  *
  * @param   string   $dirName      The full path of the directory to create
  * @param   integer  $permissions  The permissions of the created directory
  *
  * @return  boolean  True on success
  */
 public function mkdir($dirName, $permissions = 0755)
 {
     $ret = $this->fileAdapter->mkdir($dirName, $permissions);
     if (!$ret && is_object($this->abstractionAdapter)) {
         return $this->abstractionAdapter->mkdir($dirName, $permissions);
     }
     return $ret;
 }
开发者ID:edrdesigner,项目名称:awf,代码行数:17,代码来源:Hybrid.php

示例10: __construct

 public function __construct()
 {
     $dir = Config::get('app.logs.dir', '/home/storage/logs');
     $dir .= DS . APPLICATION_ENV;
     if (!is_dir($dir)) {
         File::mkdir($dir);
     }
 }
开发者ID:schpill,项目名称:standalone,代码行数:8,代码来源:logger.php

示例11: post_new

 public function post_new()
 {
     $rules = array('title' => 'required|min:5|max:128', 'street' => 'required', 'postalcode' => 'required|match:#^[1-9][0-9]{3}\\h*[A-Z]{2}$#i', 'city' => 'required', 'type' => 'required', 'surface' => 'required|integer', 'price' => 'required|numeric|max:1500|min:100', 'date' => 'required|after:' . date('d-m-Y'), 'pictures' => 'required|image|max:3000', 'register' => 'required', 'email' => 'required|email|same:email2', 'description' => 'required|min:30', 'captchatest' => 'laracaptcha|required', 'terms' => 'accepted');
     $v = Validator::make(Input::all(), $rules, Room::$messages);
     if ($v->fails()) {
         return Redirect::to('kamer-verhuren')->with_errors($v)->with('msg', '<div class="alert alert-error"><strong>Verplichte velden zijn niet volledig ingevuld</strong><br />Loop het formulier nogmaals na.</div>')->with_input();
     } else {
         if (Auth::check()) {
             $status = 'publish';
         } else {
             $status = 'pending';
         }
         $new_room = array('title' => ucfirst(Input::get('title')), 'street' => ucwords(Input::get('street')), 'housenr' => Input::get('housenr'), 'postalcode' => Input::get('postalcode'), 'city' => ucwords(Input::get('city')), 'type' => Input::get('type'), 'surface' => Input::get('surface'), 'price' => Input::get('price'), 'available' => date("Y-m-d", strtotime(Input::get('date'))), 'gender' => Input::get('gender'), 'pets' => Input::get('pets'), 'smoking' => Input::get('smoking'), 'toilet' => Input::get('toilet'), 'shower' => Input::get('shower'), 'kitchen' => Input::get('kitchen'), 'register' => Input::get('register'), 'social' => Input::get('social'), 'email' => strtolower(Input::get('email')), 'description' => ucfirst(Input::get('description')), 'status' => $status, 'url' => Str::slug(Input::get('city')), 'delkey' => Str::random(32, 'alpha'), 'del_date' => date('y-m-d', strtotime('+2 months')));
         $room = new Room($new_room);
         if ($room->save()) {
             $upload_path = path('public') . Photo::$upload_path_room . $room->id;
             if (!File::exists($upload_path)) {
                 File::mkdir($upload_path);
                 chmod($upload_path, 0777);
             }
             $photos = Photo::getNormalizedFiles(Input::file('pictures'));
             foreach ($photos as $photo) {
                 $filename = md5(rand()) . '.jpg';
                 $path_to_file = $upload_path . '/' . $filename;
                 $dynamic_path = '/' . Photo::$upload_path_room . $room->id . '/' . $filename;
                 $success = Resizer::open($photo)->resize(800, 533, 'auto')->save($path_to_file, 80);
                 chmod($path_to_file, 0777);
                 if ($success) {
                     $new_photo = new Photo();
                     $new_photo->location = $dynamic_path;
                     $new_photo->room_id = $room->id;
                     $new_photo->save();
                 }
             }
             Message::send(function ($message) use($room) {
                 $message->to($room->email);
                 $message->from('kamers@kamergenood.nl', 'Kamergenood');
                 $message->subject('In afwachting op acceptatie: "' . $room->title . '"');
                 $message->body('view: emails.submit');
                 $message->body->id = $room->id;
                 $message->body->title = $room->title;
                 $message->body->price = $room->price;
                 $message->body->type = $room->type;
                 $message->body->surface = $room->surface;
                 $message->body->available = $room->available;
                 $message->body->description = $room->description;
                 $message->body->url = $room->url;
                 $message->body->delkey = $room->delkey;
                 $message->html(true);
             });
             if (Message::was_sent()) {
                 return Redirect::to('kamer-verhuren')->with('msg', '<div class="alert alert-success"><strong>Hartelijk dank voor het vertrouwen in Kamergenood!</strong> De kameradvertentie zal binnen 24 uur worden gecontroleerd en geplaatst.</div>');
             }
         } else {
             return Redirect::to('kamer-verhuren')->with('msg', '<div class="alert alert-error"><strong>Er is iets mis gegaan bij het toevoegen.</strong> Probeer het later nog eens.</div>')->with_input();
         }
     }
 }
开发者ID:sanneterpstra,项目名称:Kamergenood,代码行数:58,代码来源:rooms.php

示例12: execute

 function execute()
 {
     Load::file('Smarty.class.php', $this->source_dir);
     $smarty = new Smarty();
     $smarty->setCompileDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'templates_c') . DS);
     $smarty->setConfigDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'configs') . DS);
     $smarty->setCacheDir(File::mkdir(TEMP_DIR . DS . $this->name . DS . 'cache') . DS);
     return $smarty;
 }
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:9,代码来源:smarty.loader.php

示例13: buildPath

 /**
  * Build path
  */
 public function buildPath()
 {
     $file = $this->image->getFile();
     $dir = dirname($file);
     $filename = basename($file);
     $path = $dir . DS . self::DIR . DS . $this->name . DS . $filename;
     File::mkdir(dirname($path));
     return $path;
 }
开发者ID:brussens,项目名称:cogear2,代码行数:12,代码来源:Preset.php

示例14: __construct

 public function __construct(array $array, $callback = null)
 {
     $path = CACHE_PATH . DS . Utils::UUID();
     File::mkdir($path);
     File::put($file, "<?php\nreturn " . var_export($array, 1) . ';');
     $this->assoc = Arrays::isAssoc($array);
     $this->file = $file;
     $this->callback = $callback;
     $this->count = count($array);
 }
开发者ID:schpill,项目名称:standalone,代码行数:10,代码来源:iterator.php

示例15: convertToFlv

 public function convertToFlv($name, $user, $videoID)
 {
     $dir = $this->uploadDir . DS . 'user' . $user . DS . $videoID;
     File::mkdir($dir);
     $command = 'C:\\ffmpeg\\bin\\ffmpeg -i ' . $this->tmpDir . DS . $name . ' -ss 00:00:01 -vframes 1 ' . $dir . DS . 'image.png';
     system($command);
     $command = 'C:\\ffmpeg\\bin\\ffmpeg -i ' . $this->tmpDir . DS . $name . ' -vcodec libx264 -crf 25 -acodec libmp3lame -ar 44100 -ab 56k -f flv ' . $dir . DS . 'video.flv';
     system($command);
     unlink($this->tmpDir . DS . $name);
 }
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:10,代码来源:ConnectionVideo.class.php


注:本文中的File::mkdir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。