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


PHP File::isDirectory方法代码示例

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


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

示例1: uploadImage

 public static function uploadImage($user_id)
 {
     $error_code = ApiResponse::OK;
     if (User::where('user_id', $user_id)->first()) {
         $profile = Profile::where('user_id', $user_id)->first();
         if (Input::hasFile('file')) {
             $file = Input::file('file');
             $destinationPath = public_path() . '/images/' . $user_id . '/avatar';
             $filename = date('YmdHis') . '_' . $file->getClientOriginalName();
             $extension = $file->getClientOriginalExtension();
             if (!File::isDirectory($destinationPath)) {
                 File::makeDirectory($destinationPath, $mode = 0777, true, true);
             }
             $upload_success = $file->move($destinationPath, $filename);
             $profile->image = 'images/' . $user_id . '/avatar/' . $filename;
             $profile->save();
             $data = URL::asset($profile->image);
         } else {
             $error_code = ApiResponse::MISSING_PARAMS;
             $data = null;
         }
     } else {
         $error_code = ApiResponse::UNAVAILABLE_USER;
         $data = ApiResponse::getErrorContent(ApiResponse::UNAVAILABLE_USER);
     }
     return array("code" => $error_code, "data" => $data);
 }
开发者ID:anht37,项目名称:winelover_server,代码行数:27,代码来源:Profile.php

示例2: simpan

 function simpan($id)
 {
     if ($this->getCount($id) > 6) {
         echo "not";
     } else {
         $pajak = new Pajak();
         $pajak->id_pengadaan = $id;
         $pajak->jenis_pajak = Input::get('jenis_pajak');
         $pajak->no_pajak = Input::get("no_pajak");
         $pajak->tgl_pajak = date('Y-m-d', strtotime(Input::get('tanggal')));
         $pajak->save();
         $id_pajak = $pajak->id_pajak;
         if (!File::isDirectory(public_path() . '/asset/img/pajak/' . $id)) {
             File::makeDirectory(public_path() . '/asset/img/pajak/' . $id);
         }
         $filenpwp = Input::file('file_npwp');
         $newnpwp = $id . '_' . $id_pajak . '.' . $filenpwp->guessClientExtension();
         Image::make($filenpwp->getRealPath())->save(public_path('/asset/img/pajak/' . $id . '/' . $newnpwp));
         $data = Pajak::find($id_pajak);
         $data->file_pajak = $newnpwp;
         if ($data->save()) {
             echo "ok";
         } else {
             echo "error";
         }
     }
 }
开发者ID:komaltech,项目名称:RPPv2,代码行数:27,代码来源:PajakController.php

示例3: 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

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     if (File::isDirectory('packages')) {
         File::deleteDirectory('packages');
     }
 }
开发者ID:kun391,项目名称:laravel-generator,代码行数:7,代码来源:TestCase.php

示例5: execute

 /**
  * Executes a program and returns the return code.
  * Output from command is logged at INFO level.
  * @return int Return code from execution.
  */
 public function execute()
 {
     // test if os match
     $myos = Phing::getProperty("os.name");
     $this->log("Myos = " . $myos, PROJECT_MSG_VERBOSE);
     if ($this->os !== null && strpos($os, $myos) === false) {
         // this command will be executed only on the specified OS
         $this->log("Not found in " . $os, PROJECT_MSG_VERBOSE);
         return 0;
     }
     if ($this->dir !== null) {
         if ($this->dir->isDirectory()) {
             $currdir = getcwd();
             @chdir($this->dir->getPath());
         } else {
             throw new BuildException("Can't chdir to:" . $this->dir->__toString());
         }
     }
     if ($this->escape == true) {
         // FIXME - figure out whether this is correct behavior
         $this->command = escapeshellcmd($this->command);
     }
     if ($this->error !== null) {
         $this->command .= ' 2> ' . $this->error->getPath();
         $this->log("Writing error output to: " . $this->error->getPath());
     }
     if ($this->output !== null) {
         $this->command .= ' 1> ' . $this->output->getPath();
         $this->log("Writing standard output to: " . $this->output->getPath());
     } elseif ($this->spawn) {
         $this->command .= ' 1>/dev/null';
         $this->log("Sending ouptut to /dev/null");
     }
     // If neither output nor error are being written to file
     // then we'll redirect error to stdout so that we can dump
     // it to screen below.
     if ($this->output === null && $this->error === null) {
         $this->command .= ' 2>&1';
     }
     // we ignore the spawn boolean for windows
     if ($this->spawn) {
         $this->command .= ' &';
     }
     $this->log("Executing command: " . $this->command);
     $output = array();
     $return = null;
     exec($this->command, $output, $return);
     if ($this->dir !== null) {
         @chdir($currdir);
     }
     foreach ($output as $line) {
         $this->log($line, $this->passthru ? PROJECT_MSG_INFO : PROJECT_MSG_VERBOSE);
     }
     if ($return != 0 && $this->checkreturn) {
         throw new BuildException("Task exited with code {$return}");
     }
     return $return;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:63,代码来源:ExecTask.php

示例6: prepare

 protected static function prepare($type)
 {
     $path = storage_path('logs/wechat');
     $file = $path . '/' . $type . '-' . date('Y-m-d') . '.log';
     if (!\File::isDirectory($path)) {
         \File::makeDirectory($path);
     }
     return $file;
 }
开发者ID:noikiy,项目名称:laravel-wechat-bundle,代码行数:9,代码来源:WechatLogger.php

示例7: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->setReplacement();
     $this->setSetting();
     if (!\File::isDirectory($this->getStorageDirectory())) {
         \File::makeDirectory($this->getStorageDirectory());
         $this->makeCrudForm();
     }
 }
开发者ID:pyaesone17,项目名称:laracrud,代码行数:14,代码来源:CRUD_FormGenerate.php

示例8: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->setReplacement();
     if (!\File::isDirectory($this->storageDirectory)) {
         \File::makeDirectory($this->storageDirectory);
     }
     $this->makeBaseRepo();
     $this->makeModelRepo();
     $this->comment(PHP_EOL . 'CRUDED IT' . PHP_EOL);
 }
开发者ID:pyaesone17,项目名称:laracrud,代码行数:15,代码来源:CRUD_Repository.php

示例9: getExistingBillTemplates

 /**
  * Get Existing Bill Templates
  */
 protected function getExistingBillTemplates()
 {
     $path = __DIR__ . '/../../../../';
     $billsTypes = \File::allFiles($path . "resources/components/bills");
     $customPath = base_path() . '/resources/views/bills';
     $customBillTypes = \File::isDirectory($customPath) ? \File::allFiles($customPath) : [];
     foreach (array_merge($billsTypes, $customBillTypes) as $billFile) {
         app('veer')->loadedComponents['billsTypes'][array_get(pathinfo($billFile), 'filename')] = array_get(pathinfo($billFile), 'filename');
     }
 }
开发者ID:artemsk,项目名称:veer-core,代码行数:13,代码来源:HelperTraits.php

示例10: make_controller

function make_controller($controller, $method)
{
    $content = "<?php\n\nclass {$controller} extends BaseController\n{\n    /**\n     * 初始化\n     * @return void\n     */\n    public function __construct()\n    {\n        parent::__construct();\n    }\n\n    /**\n     * 页面:默认\n     * @return Response\n     */\n    public function {$method}()\n    {\n        return __FILE__;\n    }\n}\n";
    $array = explode('_', $controller);
    $fileName = array_pop($array) . '.php';
    $path = app_path('controllers/' . implode('/', $array) . '/');
    // 若目录不存在,则递归创建
    File::isDirectory($path) or File::makeDirectory($path, 0777, true);
    // 创建文件
    File::put($path . '/' . $fileName, $content);
}
开发者ID:rimshavbase,项目名称:timefragment,代码行数:11,代码来源:assist.php

示例11: assets

 public function assets($file = null)
 {
     if (!is_null($file) && \File::isDirectory($this->themesAssetsPath)) {
         if (!\File::exists($this->themesAssetsPath . $file)) {
             return \Response::make("Not found!", 404);
         }
         $requestedFile = \File::get($this->themesAssetsPath . $file);
         return \Response::make($requestedFile, 200, array('Content-Type' => $this->mimeMap[\Str::lower(\File::extension($this->themesAssetsPath . $file))]));
     }
     return \Redirect::route('app.home');
 }
开发者ID:adis-me,项目名称:pageblok,代码行数:11,代码来源:AssetController.php

示例12: fire

 public function fire()
 {
     if (!$this->option('verbose')) {
         $this->output = new NullOutput();
     }
     if (\File::isDirectory($indexPath = Config::get('laravel-lucene-search.index.path'))) {
         \File::deleteDirectory($indexPath);
         $this->info('Search index is cleared.');
     } else {
         $this->comment('There is nothing to clear..');
     }
 }
开发者ID:cmoralesweb,项目名称:laravel-lucene-search,代码行数:12,代码来源:ClearCommand.php

示例13: prepareDirectories

 /**
  * Create directories necessary for backup process
  */
 private function prepareDirectories()
 {
     if (!File::isDirectory($this->userFolderPath)) {
         File::makeDirectory($this->userFolderPath, 0775);
     }
     if (!File::isDirectory($this->userFolderPath . '/files')) {
         File::makeDirectory($this->userFolderPath . '/files', 0775);
     }
     if (!File::isDirectory($this->userFolderPath . '/zip')) {
         File::makeDirectory($this->userFolderPath . '/zip', 0775);
     }
 }
开发者ID:ronnie,项目名称:Gist-List,代码行数:15,代码来源:GistBackupHandler.php

示例14: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     // Create certs dir if it doesn't exist
     if (!File::isDirectory('/data/certs')) {
         File::makeDirectory('/data/certs');
     }
     // Touch sqlite database file
     if (!File::exists('/data/trusted.sqlite')) {
         File::put('/data/trusted.sqlite', '');
         $this->call('migrate', ['--seed' => true, '--force' => true]);
     }
 }
开发者ID:designoid,项目名称:trusted,代码行数:17,代码来源:SetupCommand.php

示例15: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $dir = storage_path('backup');
     if (!\File::isDirectory($dir)) {
         \File::makeDirectory($dir);
     }
     $command = sprintf('mysqldump %s > %s -u%s -p%s', $this->option('db'), storage_path("backup/{$this->option('db')}.sql"), $this->argument('user'), $this->argument('pass'));
     system($command);
     $now = \Carbon\Carbon::now()->toDateTimeString();
     $result = "{$this->getName()} command done at {$now}";
     \Log::info($result);
     return $this->info($result);
 }
开发者ID:hongpyo,项目名称:l5essential,代码行数:18,代码来源:BackupDb.php


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