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


PHP dir::mkdir方法代码示例

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


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

示例1: _update_media_record

 function _update_media_record($id, $tmp_file_path, $file_name, $mime_type)
 {
     if (!file_exists($tmp_file_path)) {
         debug::write_error('file doesnt exist', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('tmp' => $tmp_file_path));
         return false;
     }
     if (function_exists('md5_file')) {
         $etag = md5_file($tmp_file_path);
     } else {
         $fd = fopen($data['tmp_name'], 'rb');
         $contents = fread($fd, filesize($tmp_file_path));
         fclose($fd);
         $etag = md5($contents);
     }
     if (!is_dir(MEDIA_DIR)) {
         dir::mkdir(MEDIA_DIR, 777, true);
     }
     if (!copy($tmp_file_path, MEDIA_DIR . $id . '.media')) {
         debug::write_error('temporary file copy failed', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('src' => $tmp_file_path, 'dst' => MEDIA_DIR . $id . '.media'));
         return false;
     }
     $media_db_table = db_table_factory::instance('media');
     $media_db_table->update_by_id($id, array('file_name' => $file_name, 'mime_type' => $mime_type, 'size' => filesize($tmp_file_path), 'etag' => $etag));
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:25,代码来源:media_object.class.php

示例2: write

 function write($log_file_data, $string)
 {
     $log_dir = $log_file_data[0];
     $log_name = $log_file_data[1];
     $file_name = $log_dir . $log_name;
     if (!is_dir($log_dir)) {
         dir::mkdir($log_dir, 0775, true);
     }
     $oldumask = @umask(0);
     $file_existed = @file_exists($file_name);
     $log_file = @fopen($file_name, 'a');
     if ($log_file) {
         $time = strftime("%b %d %Y %H:%M:%S", strtotime('now'));
         $notice = '[ ' . $time . " ]\n";
         if ($user_id = user::get_id()) {
             $notice .= '[ ' . $user_id . ' ] [ ' . user::get_login() . ' ] [ ' . user::get_email() . ' ] ';
         }
         $notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n";
         @fwrite($log_file, $notice);
         @fclose($log_file);
         if (!$file_existed) {
             @chmod($file_name, 0664);
         }
         @umask($oldumask);
         $result = true;
     } else {
         @umask($oldumask);
         $result = false;
         debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false);
     }
     return $result;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:32,代码来源:log.class.php

示例3: test_mkdir_windows

 function test_mkdir_windows()
 {
     if (sys::os_type() != 'win32') {
         return;
     }
     dir::mkdir(VAR_DIR . '/./tmp\\../tmp/wow////hey/', 0777, true);
     $this->assertTrue(is_dir(VAR_DIR . '/tmp/wow/hey/'));
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:test_dir.php

示例4: cp

 function cp($src, $dest)
 {
     dir::mkdir($dest, 0777);
     $arr = dir::ls($src);
     $separator = dir::separator();
     foreach ($arr as $fn) {
         if ($fn) {
             $fl = "{$src}{$separator}{$fn}";
             $flto = "{$dest}{$separator}{$fn}";
             if (is_dir($fl)) {
                 dir::cp($fl, $flto);
             } else {
                 copy($fl, $flto);
             }
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:17,代码来源:dir.class.php

示例5: _load_cache

 function _load_cache($reset = true)
 {
     if ($reset) {
         $this->reset();
     }
     $cached_dir = $this->cached_dir;
     if (!is_dir($cached_dir)) {
         if (!dir::mkdir($cached_dir, 0777, true)) {
             debug::write_error("Couldn't create cache directory {$cached_dir}, perhaps wrong permissions", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
         }
     }
     $input_files = array();
     $ini_file = '';
     $this->find_input_files($input_files, $ini_file);
     if (count($input_files) == 0) {
         return false;
     }
     $md5_files = array();
     foreach ($input_files as $input_file) {
         $md5_files[] = $input_file;
     }
     $md5_input = implode("\n", $md5_files);
     $file_name = md5($md5_input) . '.php';
     $cached_file = $cached_dir . $file_name;
     $this->cache_file = $cached_file;
     $input_time = false;
     // check for modifications
     foreach ($input_files as $input_file) {
         $file_time = filemtime($input_file);
         if ($input_time === false || $file_time > $input_time) {
             $input_time = $file_time;
         }
     }
     $load_cache = false;
     $cache_time = false;
     if (file_exists($cached_file)) {
         $cache_time = filemtime($cached_file);
         $load_cache = true;
         if ($cache_time < $input_time) {
             $load_cache = false;
         }
     }
     $use_cache = false;
     if ($load_cache) {
         $use_cache = true;
         $charset = null;
         $block_values = array();
         include $cached_file;
         if (!isset($ini_cache_code_date) or $ini_cache_code_date != INI_CACHE_CODE_DATE) {
             $this->reset();
             $use_cache = false;
         } else {
             $this->charset = $charset;
             $this->block_values = $block_values;
             $this->modified_block_values = array();
             unset($block_values);
         }
     }
     if (!$use_cache) {
         $this->_parse($input_files, $ini_file, false);
         $this->save_cache($cached_file);
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:63,代码来源:ini.class.php

示例6: rm

 function test_mkdir_relative_path_no_trailing_slash()
 { 
 	dir :: rm(TEST_DIR_RELATIVE_PATH . '/tmp/');
 	
 	$this->assertFalse(is_dir(TEST_DIR_RELATIVE_PATH . '/tmp/wow/hey/'));
 	
 	dir :: mkdir(TEST_DIR_RELATIVE_PATH . '/./tmp\../tmp/wow////hey');
 	
 	$this->assertTrue(is_dir(TEST_DIR_RELATIVE_PATH . '/tmp/wow/hey/'));
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:dir_test.class.php

示例7: cp

 function cp($src, $dest, $as_child = false, $exclude_regex = '', $include_hidden = false)
 {
     $src = dir::clean_path($src);
     $dest = dir::clean_path($dest);
     if (!is_dir($src)) {
         debug::write_error('no such a directory', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('dir' => $src));
         return false;
     }
     if (!dir::mkdir($dest)) {
         return false;
     }
     $separator = dir::separator();
     if ($as_child) {
         $separator_regex = preg_quote($separator);
         if (preg_match("#^.+{$separator_regex}([^{$separator_regex}]+)\$#", $src, $matches)) {
             dir::_do_mkdir($dest . $separator . $matches[1], 0777);
             $dest .= $separator . $matches[1];
         } else {
             return false;
         }
         //???
     }
     $items = dir::find_subitems($src, 'df', $exclude_regex, false, $include_hidden);
     $total_items = $items;
     while (count($items) > 0) {
         $current_items = $items;
         $items = array();
         foreach ($current_items as $item) {
             $full_path = $src . $separator . $item;
             if (is_file($full_path)) {
                 copy($full_path, $dest . $separator . $item);
             } elseif (is_dir($full_path)) {
                 dir::_do_mkdir($dest . $separator . $item, 0777);
                 $new_items = dir::find_subitems($full_path, 'df', $exclude_regex, $item, $include_hidden);
                 $items = array_merge($items, $new_items);
                 $total_items = array_merge($total_items, $new_items);
                 unset($new_items);
             }
         }
     }
     if ($total_items) {
         clearstatcache();
     }
     return $total_items;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:45,代码来源:dir.class.php

示例8: write_template_file

/**
* Writes a compiled template file
* 
* @param string $ filename
* @param string $ content to write to the file
* @return void 
* @access protected 
*/
function write_template_file($file, $data)
{
    if (!is_dir(dirname($file))) {
        dir::mkdir(dirname($file), 0777, true);
    }
    $fp = fopen($file, "wb");
    if (fwrite($fp, $data, strlen($data))) {
        fclose($fp);
    }
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:18,代码来源:compiler_support.inc.php

示例9: cache_lite

 /**
  * Constructor
  * 
  * $attributes is an assoc. Available attributes are :
  * 
  * @param array $attributes attributes
  * @access public 
  */
 function cache_lite($attributes = array(null))
 {
     $this->import_attributes($attributes);
     if (!is_dir(CACHE_DIR)) {
         dir::mkdir(CACHE_DIR, 0777, true);
     }
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:15,代码来源:cache_lite.class.php


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