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


PHP file類代碼示例

本文整理匯總了PHP中file的典型用法代碼示例。如果您正苦於以下問題:PHP file類的具體用法?PHP file怎麽用?PHP file使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: uploadFile2

 /**
  * @ORM\PostPersist
  */
 public function uploadFile2()
 {
     if (null === $this->file2) {
         return;
     } else {
         $this->file2->move(__DIR__ . '/../../../app/uploads' . $this->getUploadDir(), $this->second_fichier);
         unset($this->file2);
     }
 }
開發者ID:WildCodeSchool,項目名稱:partnet,代碼行數:12,代碼來源:Formations.php

示例2: createAndWrite

function createAndWrite($file, $string)
{
    $file_ins = new file();
    if ($file_ins->createFile($file)) {
        $file_ins->writeToFile($string);
        return True;
    } else {
        return False;
    }
}
開發者ID:Cerberus1746,項目名稱:CyberX-Web-Framework,代碼行數:10,代碼來源:files.php

示例3: upload

 /**
  * @ORM\PostPersist
  */
 public function upload()
 {
     if (null === $this->file) {
         return;
     }
     // if there is an error when moving the file, an exception will
     // be automatically thrown by move(). This will properly prevent
     // the entity from being persisted to the database on error
     $this->file->move($this->getUploadRootDir(), $this->photo);
     unset($this->file);
 }
開發者ID:WildCodeSchool,項目名稱:partnet,代碼行數:14,代碼來源:Organisme.php

示例4: file_upload

function file_upload($files)
{
    global $upload_path;
    $objects = array();
    foreach ($files as $file) {
        if (!empty($file['name'])) {
            $obj = new file();
            $obj->upload($file);
            $objects[] = $obj;
        }
    }
    return $objects;
}
開發者ID:nodefortytwo,項目名稱:areyouhappy,代碼行數:13,代碼來源:file.php

示例5: __destruct

 public function __destruct()
 {
     flush();
     if (!is_dir(ROOT . 'task')) {
         return false;
     }
     if (AJAX) {
         return false;
     }
     //ajax操作的時候不做計劃任務
     if (defined('CLOSETASK')) {
         return false;
     }
     extract($this->info);
     /** 分時計劃任務 **/
     $file = new file();
     $db = new db();
     $str = new str();
     $time = time();
     $today = $str->formatDate($time, 'Ymd');
     for ($i_task = 1; $i_task <= 6; $i_task++) {
         if ($time - intval(kc_config('task.update' . $i_task)) > 3600 * $i_task) {
             $tasks = $file->getDir('task/' . $i_task . '/', 'php');
             if (!empty($tasks)) {
                 foreach ($tasks as $k => $v) {
                     require ROOT . $k;
                 }
             }
             unset($tasks);
             $db->update('%s_config', array('value' => $time), "class='task' and name='update{$i_task}'");
         }
     }
     //開始執行每日計劃任務
     if (kc_config('task.day') != $today) {
         $tasks = $file->getDir('task/day/', 'php');
         if (!empty($tasks)) {
             foreach ($tasks as $k => $v) {
                 require ROOT . $k;
             }
         }
         unset($tasks);
         $db->update('%s_config', array('value' => $today), "class='task' and name='day'");
     }
     //刷新即可執行
     $tasks = $file->getDir('task/0/', 'php');
     if (!empty($tasks)) {
         foreach ($tasks as $k => $v) {
             require ROOT . $k;
         }
     }
 }
開發者ID:kissthink,項目名稱:ym_oauth,代碼行數:51,代碼來源:user.class.php

示例6: addNewFromFiles

 /**
  * Adding new files from Request in begin of uploading
  *
  * @param file $files   
  */
 public function addNewFromFiles($files)
 {
     $file = $files->get('file');
     $fileFullName = $file->getClientOriginalName();
     $this->status = self::STATUS_NEW;
     $this->fullname = $fileFullName;
     $fileParts = explode(".", $fileFullName);
     $this->ext = end($fileParts);
     $this->name = str_replace('.' . $this->ext, '', $fileFullName);
     $this->created = time();
     $this->mime = $file->getMimeType();
     $this->size = $file->getSize();
     $this->save();
     return $this;
 }
開發者ID:andrewkrug,項目名稱:repucaution,代碼行數:20,代碼來源:file.php

示例7: getSampleCode

 public static function getSampleCode($assignment_id, $code_id = null)
 {
     $path = dirname(dirname(dirname(__FILE__))) . "/files/sample_code/" . $assignment_id . "/";
     if (is_null($code_id)) {
         $files = file::dirContent();
     }
 }
開發者ID:TinoChow9792,項目名稱:CodeTogether,代碼行數:7,代碼來源:File.php

示例8: getUnInstalled

 public function getUnInstalled()
 {
     $installed = (array) $this->getInstalled();
     $folders = dir::folders(ZPATH_MODULES, '.', false);
     $folders = array_diff($folders, array_keys($installed));
     $modules = array();
     foreach ($folders as $folder) {
         $modulePath = ZPATH_MODULES . DS . $folder;
         $moduleUrl = url::modules() . '/' . $folder;
         $moduleFile = $modulePath . DS . 'module.php';
         if (file::exists($moduleFile)) {
             $m = (include $moduleFile);
             $m['path'] = '$modules/' . $folder;
             $m['url'] = '$modules/' . $folder;
             if (!isset($m['icon'])) {
                 if (!file::exists($modulePath . '/icon.png')) {
                     $m['icon'] = url::theme() . '/image/skin/none.png';
                 } else {
                     $m['icon'] = $moduleUrl . '/icon.png';
                 }
             }
             $modules[$m['id']] = $m;
         }
     }
     return $modules;
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:26,代碼來源:module.php

示例9: eqphp_autoload

function eqphp_autoload($class)
{
    if (isset($_SERVER['REQUEST_URI'])) {
        $root = current(explode('/', trim($_SERVER['REQUEST_URI'], '/')));
    }
    //optimize: $config save memcache or redis
    $group = config('group.list');
    $path = isset($root) && is_array($group) && in_array($root, $group) ? $root . '/' : '';
    $module = array('a' => $path . 'action', 'm' => $path . 'model', 'p' => $path . 'plugin', 's' => 'server');
    $prefix = substr($class, 0, strpos($class, '_'));
    $dir_name = in_array($prefix, array('a', 'm', 's', 'p')) ? $module[$prefix] : 'class';
    $execute_file = $dir_name . '/' . $class . '.php';
    if (file_exists($execute_file)) {
        return include PATH_ROOT . $execute_file;
    }
    //通用加載
    if (config('state.common_load') && in_array($prefix, array('a', 'm'), true)) {
        $common_option = array('a' => 'action/', 'm' => 'model/');
        $execute_file = PATH_ROOT . $common_option[$prefix] . $class . '.php';
        if (file_exists($execute_file)) {
            return include $execute_file;
        }
    }
    //貪婪加載
    if (config('state.greedy_load')) {
        $execute_file = file::search(PATH_ROOT . $dir_name, $class, $file_list, true);
        if ($execute_file) {
            return include $execute_file;
        }
    }
    if ($prefix === 'a') {
        logger::notice('class [' . $class . '] not found');
        http::send(404);
    }
}
開發者ID:lianren,項目名稱:framework,代碼行數:35,代碼來源:common.php

示例10: CheckTemplate

 /**
  *
  * @static
  * @param string $filename
  * @return bool
  */
 public static function CheckTemplate($filename = "")
 {
     try {
         if (empty($filename)) {
             $objTemplate = new file(THEME_PREFIX . Settings::$page_templates_path . self::$template);
             return $objTemplate->Exists();
         } else {
             $objTemplate = new file(THEME_PREFIX . Settings::$page_templates_path . $filename);
             return $objTemplate->Exists();
         }
     } catch (Exception $e) {
         Debug::Log($e, ERROR);
         return false;
     }
     return true;
 }
開發者ID:BGCX261,項目名稱:zoneideas-svn-to-git,代碼行數:22,代碼來源:viewer.class.php

示例11: execTinyMce

	protected function execTinyMce($prm=null) {
		$search = 'js/tiny_mce/';
		$request = request::get('request');
		$pos = strpos($request, $search);
		if ($pos === false)
			exit;
		$tmp = substr($request, $pos+strlen($search));
		$file = file::nyroExists(array(
			'name'=>'lib'.DS.'tinyMce'.DS.$tmp,
			'realName'=>true,
			'type'=>'other'
		));
		if (strpos($file, '.php') !== false) {
			array_walk($_GET, create_function('&$v', '$v = urldecode($v);'));
			$path = str_replace($tmp, '', $file);
			ini_set('include_path', $path);
			define('TINYMCEPATH', substr($path, 0, -1));
			define('TINYMCECACHEPATH', substr(TMPROOT, 0, -1));
			if (ob_get_length())
				ob_clean();
			include($file);
			exit;
		} else
			response::getInstance()->showFile($file);
	}
開發者ID:nyroDev,項目名稱:nyroFwk,代碼行數:25,代碼來源:controller.class.php

示例12: get_file_list

 function get_file_list($dir, $attimg)
 {
     $imgname['size'] = 0;
     foreach ($dir as $filedirs) {
         $filedir = HDWIKI_ROOT . '/' . $filedirs;
         file::forcemkdir($filedir);
         $handle = opendir($filedir);
         $i = 0;
         while ($filename = readdir($handle)) {
             if (!is_dir($filedir . '/' . $filename) && '.' != $filename && '..' != $filename && '.svn' != $filename && 'index.htm' != $filename) {
                 $fstr = explode(".", $filename);
                 $flast = substr(strrchr($fstr[0], '_'), 1);
                 if (!in_array($filedirs . '/' . $filename, $attimg)) {
                     //if !in_array($filedirs.'/'.$filename,$attimg) && $flast!='140' && $flast!="s"
                     $i++;
                     $imgname[] = $filedirs . '/' . $filename;
                     $imgname['size'] += filesize($filedir . '/' . $filename);
                 }
             }
         }
         $imgname['num'] = $i;
         closedir($handle);
     }
     return $imgname;
 }
開發者ID:meiwenhui,項目名稱:hdwiki,代碼行數:25,代碼來源:rubbish.class.php

示例13: get_upload_data

 /**
  * get full information for an upload
  *
  * @param string $file 
  * @param array $file_data 
  * @return array
  * @author Andy Bennett
  */
 function get_upload_data($file, $file_data)
 {
     $filename = self::save($file);
     if (APPENV == 'frontend') {
         $upl_dir = str_replace('frontend', 'backend', Kohana::config('upload.directory'));
         if (!copy($filename, $upl_dir . basename($filename))) {
             Kohana::log('error', "COPY FAILED: copy({$filename}, {$upl_dir}.basename({$filename}))");
         }
     }
     $pp = pathinfo($filename);
     $ext = $pp['extension'];
     $file_type = self::check_filetype($file_data['type'], $filename);
     $d = Kohana::config('upload.directory');
     $upload_data['file_name'] = $pp['basename'];
     $upload_data['file_type'] = $file_type;
     $upload_data['file_path'] = $d;
     $upload_data['full_path'] = $filename;
     $upload_data['raw_name'] = $pp['filename'];
     $upload_data['orig_name'] = $file_data['name'];
     $upload_data['file_ext'] = '.' . strtolower($ext);
     $upload_data['file_size'] = $file_data['size'];
     $upload_data['is_image'] = file::is_image($file_type);
     $upload_data['date_added'] = date('Y-m-d H:i:s');
     if ($upload_data['is_image']) {
         $properties = file::get_image_properties($filename);
         if (!empty($properties)) {
             $upload_data = array_merge($upload_data, $properties);
         }
     }
     return $upload_data;
 }
開發者ID:AsteriaGamer,項目名稱:steamdriven-kohana,代碼行數:39,代碼來源:MY_upload.php

示例14: install

 public function install($path)
 {
     $module = @(include path::decode($path . DS . 'module.php'));
     if (is_array($module)) {
         $module['path'] = $path;
         $module['url'] = $path;
         if (!isset($module['icon'])) {
             if (file::exists($path . '/icon.png')) {
                 $module['icon'] = $module['url'] . '/icon.png';
             }
         }
         $module['type'] = empty($module['type']) ? 'plugin' : $module['type'];
         $module['status'] = 0;
         $module['order'] = $this->max('order') + 1;
         $module['installtime'] = TIME;
         $module['updatetime'] = TIME;
         $insert = $this->insert($module);
     }
     if ($insert) {
         $driver = $this->db()->config('driver');
         $sqls = file::read($path . DS . 'install' . DS . $driver . '.sql');
         if ($sqls) {
             $this->db()->run($sqls);
         }
     }
     return true;
 }
開發者ID:dalinhuang,項目名稱:zotop,代碼行數:27,代碼來源:module.php

示例15: save

 /**
 * start upload
 +-----------------------------------------
 * @access public
 * @param string $path
 * @return void
 */
 public function save($path = '/', $web_path = '')
 {
     // check dir
     if (!is_dir($path)) {
         $this->error = 2404;
         return false;
     } else {
         if (!file::_is_writable($path)) {
             $this->error = 2655;
             return false;
         }
     }
     $files_rs = array();
     $this->save_path = $path;
     $this->web_path = $web_path;
     $this->file_upload_count = 0;
     foreach ($_FILES as $name => $file) {
         $files_rs[$name] = array();
         if (is_array($file['name'])) {
             $this->multiple($file['name'], $file['type'], $file['tmp_name'], $file['error'], $file['size'], $files_rs[$name]);
         } else {
             $files_rs[$name] = $this->_save($file);
         }
     }
     return $files_rs;
 }
開發者ID:page7,項目名稱:amazon.jp.price.log,代碼行數:33,代碼來源:upload.class.php


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