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


PHP File::makeDirectory方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['file' => 'required']);
     $file = $request->file('file');
     $original_file_name = $file->getClientOriginalName();
     $file_name = pathinfo($original_file_name, PATHINFO_FILENAME);
     $extension = \File::extension($original_file_name);
     $actual_name = $file_name . '.' . $extension;
     $apk = new \ApkParser\Parser($file);
     $manifest = $apk->getManifest();
     $labelResourceId = $apk->getManifest()->getApplication()->getLabel();
     $appLabel = $apk->getResources($labelResourceId);
     $package_name = $manifest->getPackageName();
     if (Apk::packageExist($package_name)) {
         Session::flash('flash_class', 'alert-danger');
         Session::flash('flash_message', 'Apk namespace already exist.');
         return redirect()->route("apk.create");
     }
     Apk::create(array('app_name' => $appLabel[0], 'pkgname' => $package_name, 'version' => $manifest->getVersionCode(), 'version_name' => $manifest->getVersionName(), 'md5' => md5_file($file), 'filename' => $actual_name, 'filesize' => str_format_filesize(\File::size($file)), 'token' => md5(uniqid(mt_rand(), true))));
     $folderpath = base_path() . '/storage/apk/' . $manifest->getPackageName();
     if (!\File::exists($folderpath)) {
         \File::makeDirectory($folderpath);
     }
     $file_path = $request->file('file')->move($folderpath, $actual_name);
     return redirect()->route("apk.index");
 }
开发者ID:renciebautista,项目名称:pcount2,代码行数:32,代码来源:ApkController.php

示例2: testFile

 /**
  * @covers Kotchasan\File::makeDirectory
  * @todo   Implement testMakeDirectory().
  */
 public function testFile()
 {
     $this->object->makeDirectory('temp/');
     $this->object->makeDirectory('temp/test/');
     $f = fopen('temp/test/index.php', 'w');
     fclose($f);
     $this->object->copyDirectory('temp/test/', 'temp/');
     $result = array();
     $this->object->listFiles('temp/test/', $result);
     $this->object->removeDirectory('temp/');
     $this->assertEquals(array('temp/test/index.php'), $result);
 }
开发者ID:goragod,项目名称:kotchasan,代码行数:16,代码来源:FileTest.php

示例3: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $path = $this->getFilePath();
     $directory = dirname($path);
     if ($this->file->exists($path)) {
         $this->error("A view already exists at {$path}!");
         return false;
     }
     if (!$this->file->exists($directory)) {
         $this->file->makeDirectory($directory, 0777, true);
     }
     $this->file->put($path, $this->getViewContents());
     $this->info("Created a new view at {$path}");
 }
开发者ID:maddhatter,项目名称:laravel-view-generator,代码行数:19,代码来源:MakeViewCommand.php

示例4: run

 public function run()
 {
     DB::table('products_sika')->truncate();
     File::cleanDirectory(public_path('assets/img/products/sika'));
     File::makeDirectory(public_path('assets/img/products/sika/tech-carts'), true, true);
     factory(App\ProductSika::class, 10)->create();
 }
开发者ID:alexmon1989,项目名称:kadsgroup,代码行数:7,代码来源:ProductsSikaTableSeeder.php

示例5: getFile

 /**
  * Funcao para edicao da config do [Modulo]
  * @param string $controller Nome do controlador
  * @return void
  */
 public function getFile($controller)
 {
     // $this->logic->_getConfigFiles();
     // Busca o arquivo especificado
     $cfg_file = mkny_model_config_path($controller) . '.php';
     // Field types
     $f_types = array_unique(array_values(app()->make('Mkny\\Cinimod\\Logic\\AppLogic')->_getFieldTypes()));
     // Se o diretorio nao existir
     if (!realpath(dirname($cfg_file))) {
         \File::makeDirectory(dirname($cfg_file));
     }
     // Config file data
     if (!\File::exists($cfg_file)) {
         $stub = \File::get(__DIR__ . '/../Commands/stubs/model_config.stub');
         \Mkny\Cinimod\Logic\UtilLogic::translateStub(array('var_fields_data' => ''), $stub);
         \File::put($cfg_file, $stub);
     }
     // Config file data
     $config_str = \File::getRequire($cfg_file)['fields'];
     // Pula o primeiro indice
     // array_shift($config_str);
     $valOrder = 1;
     // Fornece o tipo "types" para todos os campos, para selecao
     foreach ($config_str as $key => $value) {
         if (!is_array($config_str[$key])) {
             $config_str[$key] = array();
         }
         $config_str[$key]['name'] = $key;
         $config_str[$key]['type'] = isset($value['type']) ? $value['type'] : 'string';
         $config_str[$key]['form_add'] = isset($value['form_add']) ? $value['form_add'] : true;
         $config_str[$key]['form_edit'] = isset($value['form_edit']) ? $value['form_edit'] : true;
         $config_str[$key]['grid'] = isset($value['grid']) ? $value['grid'] : true;
         $config_str[$key]['relationship'] = isset($value['relationship']) ? $value['relationship'] : false;
         $config_str[$key]['required'] = isset($value['required']) ? $value['required'] : false;
         $config_str[$key]['searchable'] = isset($value['searchable']) ? $value['searchable'] : false;
         $config_str[$key]['order'] = isset($value['order']) ? $value['order'] : $valOrder++;
         $config_str[$key]['types'] = array_combine($f_types, $f_types);
     }
     if (isset(array_values($config_str)[1]['order'])) {
         usort($config_str, function ($dt, $db) {
             if (!isset($db['order'])) {
                 $db['order'] = 0;
             }
             if (isset($dt['order'])) {
                 return $dt['order'] - $db['order'];
             } else {
                 return 0;
             }
         });
         $newConfig = [];
         foreach ($config_str as $sortfix) {
             $newConfig[$sortfix['name']] = $sortfix;
         }
         $config_str = $newConfig;
     }
     $data['controller'] = $controller;
     $data['data'] = $config_str;
     return view('cinimod::admin.generator.config_detailed_new')->with($data);
     // return view('cinimod::admin.generator.config_detailed')->with($data);
 }
开发者ID:mkny,项目名称:cinimod,代码行数:65,代码来源:ConfigurationController.php

示例6: upload

 /**
  * @param $file
  * @return array
  */
 public function upload($file)
 {
     if (!$file->getClientOriginalName()) {
         return ['status' => false, 'code' => 404];
     }
     $destinationPath = public_path() . $this->imgDir;
     $fileName = $file->getClientOriginalName();
     $fileSize = $file->getClientSize();
     $ext = $file->guessClientExtension();
     $type = $file->getMimeType();
     $upload_success = Input::file('file')->move($destinationPath, $fileName);
     if ($upload_success) {
         $md5_name = md5($fileName . time()) . '.' . $ext;
         $_uploadFile = date('Ymd') . '/' . $md5_name;
         if (!File::isDirectory($destinationPath . date('Ymd'))) {
             File::makeDirectory($destinationPath . date('Ymd'));
         }
         // resizing an uploaded file
         Image::make($destinationPath . $fileName)->resize($this->width, $this->height)->save($destinationPath . $_uploadFile);
         File::delete($destinationPath . $fileName);
         $data = ['status' => true, 'code' => 200, 'file' => ['disk_name' => $fileName, 'file_name' => $md5_name, 'type' => $type, 'size' => $fileSize, 'path' => $this->imgDir . $_uploadFile]];
         return $data;
     } else {
         return ['status' => false, 'code' => 400];
     }
 }
开发者ID:leebivip,项目名称:laravel_cmp,代码行数:30,代码来源:Uploader.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $authuser = Auth::user();
     $nombreDeUsuario = Input::get('nombreDeUsuario');
     $idproveedor = Input::get('idproveedor');
     if (!File::exists('images/proveedores/' . $nombreDeUsuario . '/galeria')) {
         $result = File::makeDirectory('images/proveedores/' . $nombreDeUsuario . '/galeria', 0777);
     }
     $imagen_intro = Input::file('galeria');
     foreach ($imagen_intro as $file) {
         $rules = array('file' => 'required|mimes:png,gif,jpeg|max:200000000');
         $validator = Validator::make(array('file' => $file), $rules);
         if ($validator->fails()) {
             return Redirect::to("vistausuario/proveedorgaleria")->with(array('usuarioimg' => $authuser->imagen, 'usuarionombre' => $authuser->nombre, 'usuarioid' => $authuser->id))->withErrors($validator)->withInput();
         }
     }
     foreach ($imagen_intro as $file) {
         $proveedores_galeria = new ProveedorGaleria();
         $id = Str::random(4);
         $date_now = new DateTime();
         $destinationPath = 'images/proveedores/' . $nombreDeUsuario . '/galeria';
         $filename = $date_now->format('YmdHis') . $id;
         $mime_type = $file->getMimeType();
         $extension = $file->getClientOriginalExtension();
         $upload_success = $file->move($destinationPath, $filename . '.' . $extension);
         $proveedores_galeria->id = 0;
         $proveedores_galeria->proveedores_idproveedor = $idproveedor;
         $proveedores_galeria->imagen = $filename . '.' . $extension;
         $proveedores_galeria->texto = "";
         $proveedores_galeria->save();
         unset($proveedores_galeria);
     }
     return Redirect::to("vistausuario/proveedorgaleria")->with(array('usuarioimg' => $authuser->imagen, 'usuarionombre' => $authuser->nombre, 'usuarioid' => $authuser->id));
 }
开发者ID:ubx-caloca,项目名称:todoconstruimos,代码行数:40,代码来源:ProveedorGaleriaVistaController.php

示例8: update

 public function update($id)
 {
     $setting = Setting::findOrFail($id);
     $validator = Validator::make($data = Input::all(), Setting::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     unset($data['logo']);
     // Logo Image Upload
     if (Input::hasFile('logo')) {
         $path = public_path() . "/assets/admin/layout/img/";
         File::makeDirectory($path, $mode = 0777, true, true);
         $image = Input::file('logo');
         $extension = $image->getClientOriginalExtension();
         $filename = "logo.{$extension}";
         $filename_big = "logo-big.{$extension}";
         Image::make($image->getRealPath())->save($path . $filename);
         Image::make($image->getRealPath())->save($path . $filename_big);
         $data['logo'] = $filename;
     }
     $currencyArray = explode(':', $data['currency']);
     $data['currency'] = $currencyArray[1];
     $data['currency_icon'] = $currencyArray[0];
     $setting->update($data);
     Session::flash('success', '<strong>Success! </strong>Updated Successfully');
     return Redirect::route('admin.settings.edit', 'setting');
 }
开发者ID:rodrigopbel,项目名称:ong,代码行数:27,代码来源:SettingsController.php

示例9: testAssetImageFound

 public function testAssetImageFound()
 {
     \File::makeDirectory(storage_path('moximanager'), 0755, false, true);
     copy(realpath(__DIR__ . '/../../../data/5601729.gif'), storage_path('moximanager/5601729.gif'));
     $response = $this->call('GET', 'storage/moximanager/5601729.gif');
     $this->assertEquals(200, $response->getStatusCode());
 }
开发者ID:distilleries,项目名称:expendable,代码行数:7,代码来源:AssetControllerTest.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $project = new Project();
     $project->title = $request->title;
     $directory = public_path() . '/' . $request->title;
     \File::makeDirectory($directory);
     $project->description = $request->description;
     $project->owner = \Auth::user()->id;
     if ($project->save()) {
         if ($request->hasFile('audio')) {
             $file = $request->file('audio');
             $file->move($directory, $file->getClientOriginalName());
             $path = $project->title . '/' . $file->getClientOriginalName();
             if (file_exists($path)) {
                 $layer = new Layer();
                 $layer->label = $request->label;
                 $layer->path = $path;
                 $layer->user_id = \Auth::user()->id;
                 $layer->project_id = $project->id;
                 $layer->save();
             }
         }
     }
     return \Redirect::home();
 }
开发者ID:Alymosul,项目名称:HCI,代码行数:31,代码来源:ProjectsController.php

示例11: fire

 public function fire()
 {
     $options = $this->option();
     $this->seed_path = storage_path('seeder');
     Asset::setFromSeed(true);
     // -------------------------------------
     if (is_true($options['reset'])) {
         if (Config::getEnvironment() == 'production') {
             $really = $this->confirm('This is the *** PRODUCTION *** server are you sure!? [yes|no]');
             if (!$really) {
                 $this->info("**** Exiting ****");
                 exit;
             }
         }
         if (!File::exists($this->seed_path)) {
             File::makeDirectory($this->seed_path);
             $n = 50;
             for ($i = 1; $i <= $n; $i++) {
                 $gender_types = ['men', 'women'];
                 foreach ($gender_types as $gender) {
                     $user_photo_url = "http://api.randomuser.me/portraits/{$gender}/{$i}.jpg";
                     File::put($this->seed_path . "/{$gender}_{$i}.jpg", file_get_contents($user_photo_url));
                 }
                 $this->info("Cache user seed image - {$i}");
             }
         }
         if ($this->confirm('Do you really want to delete the tables? [yes|no]')) {
             // first delete all assets
             if (Schema::hasTable('assets')) {
                 foreach (Asset::all() as $asset) {
                     $asset->delete();
                 }
             }
             $name = $this->call('migrate');
             $name = $this->call('migrate:reset');
             File::deleteDirectory(public_path('assets/content/users'));
             $this->info('--- Halp has been reset ---');
         }
         Auth::logout();
         $this->setupDatabases();
         return;
     }
     // -------------------------------------
     if (is_true($options['setup'])) {
         $this->setupDatabases();
     }
     // -------------------------------------
     if ($options['seed'] == 'all') {
         $this->seed();
     }
     if ($options['seed'] == 'users') {
         $this->seedUsers();
     }
     if ($options['seed'] == 'tasks') {
         $this->seedTasks();
     }
     if ($options['seed'] == 'projects') {
         $this->seedProjects();
     }
 }
开发者ID:vanderlin,项目名称:halp,代码行数:60,代码来源:SetupSite.php

示例12: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //borrramos generaciones previas
     File::deleteDirectory(app_path('modelos_generados'));
     //creamos el directorio en app..
     File::makeDirectory(app_path('modelos_generados'), 777);
     $tablas = SchemaHelper\Table::getTablesCurrentDatabase();
     $this->info("Buscando tablas..");
     foreach ($tablas as $tabla) {
         $this->info("Generando Modelo de la tabla: " . $tabla->table_name);
         //class name
         $class_name = ucfirst(camel_case(str_singular_spanish($tabla->table_name)));
         $baseString = File::get(app_path('models/Schema/Template.txt'));
         //replace class name..
         $baseString = str_replace('@class_name@', $class_name, $baseString);
         //replace table name..
         $baseString = str_replace('@table_name@', $tabla->table_name, $baseString);
         //replace pretty name..
         $baseString = str_replace('@pretty_name@', $tabla->table_name, $baseString);
         //find columns.
         $columns = $tabla->columns()->whereNotIn('column_name', static::$common_hidden)->get();
         //generate fillable
         $baseString = str_replace('@fillable@', $this->generarFillable($columns), $baseString);
         //generate pretty fields string.
         $baseString = str_replace('@pretty_fields@', $this->generarPrettyFields($columns), $baseString);
         //generate rules..
         $baseString = str_replace('@rules@', $this->genenarRules($columns), $baseString);
         //generate belongs to..
         $baseString = str_replace('@belongs_to@', $this->generarBelongsTo($columns), $baseString);
         File::put(app_path('modelos_generados/' . $class_name . '.php'), $baseString);
     }
     $this->info("Generación terminada.");
 }
开发者ID:richarrieta,项目名称:miequipo,代码行数:38,代码来源:GenerarModelos.php

示例13: __construct

 /**
  * Class constructor
  */
 public function __construct()
 {
     //  folder cache
     $dir = ROOT_PATH . DATA_FOLDER . 'cache/';
     if (\File::makeDirectory($dir)) {
         $this->cache_dir = $dir;
         $this->cache_expire = self::$cfg->get('cache_expire', 5);
         // clear old cache every day
         $d = is_file($dir . 'index.php') ? file_get_contents($dir . 'index.php') : 0;
         if ($d != date('d')) {
             $this->clear();
             $f = @fopen($dir . 'index.php', 'wb');
             if ($f) {
                 fwrite($f, date('d'));
                 fclose($f);
             } else {
                 $message = sprintf(\Language::get('The file or folder %s can not be created or is read-only, please create or adjust the chmod it to 775 or 777.'), 'cache/index.php');
                 log_message('Warning', $message, __FILE__, __LINE__);
             }
         }
     } else {
         $message = sprintf(\Language::get('The file or folder %s can not be created or is read-only, please create or adjust the chmod it to 775 or 777.'), 'cache/');
         log_message('Warning', $message, __FILE__, __LINE__);
     }
 }
开发者ID:roongr2k7,项目名称:kotchasan,代码行数:28,代码来源:cache.php

示例14: getFile

 public function getFile($lang = false, $module = false)
 {
     // dd(view()->shared('controller'));
     // app('request')->attributes->get('controller');
     if (!$lang) {
         $lang = \App::getLocale();
     }
     // Busca o arquivo especificado
     $cfg_file = mkny_lang_path($lang . '/' . $module) . '.php';
     // Field types
     $f_types = array_unique(array_values(app()->make('Mkny\\Cinimod\\Logic\\AppLogic')->_getFieldTypes()));
     // Se o diretorio nao existir
     if (!realpath(dirname($cfg_file))) {
         \File::makeDirectory(dirname($cfg_file));
     }
     // Config file data
     if (!\File::exists($cfg_file)) {
         \File::put($cfg_file, "<?php return array( 'teste' => 'teste' );");
     }
     // Arquivo aberto
     $config_str = \File::getRequire($cfg_file);
     $arrFields = array();
     foreach ($config_str as $field_name => $field_value) {
         if (!is_string($field_value)) {
             $arrFields[$field_name] = array('name' => $field_name, 'trans' => $field_name, 'values' => $field_value, 'type' => 'multi');
         } else {
             $arrFields[$field_name] = array('name' => $field_name, 'trans' => $field_name, 'default_value' => $field_value, 'type' => 'string');
         }
     }
     return view('cinimod::admin.generator.trans_detailed')->with(['form' => app()->make('\\Mkny\\Cinimod\\Logic\\FormLogic', [['fields-default-class' => 'form-control']])->getForm(false, action('\\' . get_class($this) . '@postFile', [$lang, $module]), $arrFields, $module)]);
 }
开发者ID:mkny,项目名称:cinimod,代码行数:31,代码来源:TranslateController.php

示例15: addCatalog

 public function addCatalog(Request $request)
 {
     log::info('add catalog');
     log::info($request);
     try {
         if ($request->get("img") != null) {
             log::info('if');
             $base64data = $request->get("img");
             $filename = str_random(60);
             $uri = substr($base64data, strpos($base64data, ",") + 1);
             $url = public_path() . '/fm_user/images/fm/catalog/' . $request->get('shop_id') . '/';
             if (!File::exists($url)) {
                 File::makeDirectory($url, $mode = 0777, true, true);
             }
             File::put($url . $filename . '.jpg', base64_decode($uri));
             $catalogData = array('media_url' => $url . $filename . '.jpg');
         }
         $catalogData['location_id'] = $request->get('location_id');
         $catalogData['description'] = $request->get('description');
         $catalogData['name'] = $request->get('name');
         $catalogId = Catalog::create($catalogData)->id;
         return Response::json($catalogId);
     } catch (Exception $e) {
         log::info($e);
         return Response::json('ERROR');
     }
 }
开发者ID:leloulight,项目名称:fashionmonkee,代码行数:27,代码来源:ShopController.php


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