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


PHP fs::mkdir方法代码示例

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


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

示例1: 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)) {
         fs::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";
         $user =& user::instance();
         if (($user_id = $user->get_id()) != DEFAULT_USER_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,代码行数:33,代码来源:log.class.php

示例2: 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))) {
        fs::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

示例3: write

 function write(&$content)
 {      
   if(!$id = $this->get_cache_id())
     return false;      
   
   fs :: mkdir(PAGE_CACHE_DIR);
   
   $tmp = tempnam(PAGE_CACHE_DIR, '_');
   $f = fopen($tmp, 'w');
   fwrite($f, $content);
   fclose($f);
   
   if(file_exists(PAGE_CACHE_DIR . $id))
     unlink(PAGE_CACHE_DIR . $id);
   
   return rename($tmp,  PAGE_CACHE_DIR . $id);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:17,代码来源:partial_page_cache_manager.class.php

示例4: _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);
     }
     fs::mkdir(MEDIA_DIR);
     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));
     $this->set_attribute('etag', $etag);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:24,代码来源:media_object.class.php

示例5: get_cache_size

 function get_cache_size()
 {
     fs::mkdir(PAGE_CACHE_DIR);
     $files = fs::find_subitems(PAGE_CACHE_DIR, 'f', '~^[^p]~');
     $size = 0;
     foreach ($files as $file) {
         $size += filesize($file);
     }
     return $size;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:10,代码来源:partial_page_cache_manager.class.php

示例6: mkdir

 function _cache_media_file($media_id, $extension)
 {
   fs :: mkdir(IMAGE_CACHE_DIR);
   
   if(file_exists(MEDIA_DIR . $media_id . '.media') && !file_exists(IMAGE_CACHE_DIR . $media_id . $extension))
     copy(MEDIA_DIR . $media_id . '.media', IMAGE_CACHE_DIR . $media_id . $extension);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:image_cache_manager.class.php

示例7: filemtime

	function _load_cache()
	{
		$this->reset();

		$cache_dir = $this->cache_dir;

		if (!is_dir($cache_dir))
		{
			if (!fs :: mkdir($cache_dir, 0777, true))
				debug::write_error("Couldn't create cache directory $cache_dir, perhaps wrong permissions", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
		} 

		$this->cache_file = $this->cache_dir . md5($this->file_path) . '.php';

		if (file_exists($this->cache_file) && 
		    filemtime($this->cache_file) > filemtime($this->file_path))
		{
			$charset = null;
			$group_values = array();
			
			include($this->cache_file);
			
			$this->charset = $charset;
			$this->group_values = $group_values;
			unset($group_values);		
		} 
		else
		{
			$this->_parse();
			$this->_save_cache();
	  }
	} 
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:32,代码来源:ini.class.php

示例8: mkdir

  function _write_media_file($media_id)
  {
    fs :: mkdir(MEDIA_DIR);

    $f = fopen(MEDIA_DIR . $media_id . '.media', 'w');
    fwrite($f, 'test');
    fclose($f);
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:8,代码来源:image_cache_manager_test.class.php

示例9: show_debug

 function &parse_html_console($server_file_path = VAR_WEB_DIR)
 {
     if (!debug::is_debug_enabled()) {
         return '';
     }
     $debug =& debug::instance();
     $report =& $debug->_parse_report_internal(true);
     $ip = sys::client_ip();
     $js_window = "\r\n            <script language='javascript'>\r\n            <!-- hide this script from old browsers\r\n\r\n            function show_debug( file_name, title )\r\n            {\r\n              rn = Math.random();\r\n              debug_window = window.open( file_name + '?rn=' + rn, title, 'top=370,left=550,height=300,width=400,scrollbars,resizable');\r\n            }\r\n\r\n            show_debug('{$server_file_path}{$ip}-debug.html', 'debug');\r\n\r\n            //-->\r\n            </script>";
     $header = '<html><head><script>var NEED_TO_FOCUS = false</script><title>debug</title></head><body onload="if(NEED_TO_FOCUS)window.focus();else window.blur()">';
     $footer = '</body></html>';
     fs::mkdir(VAR_DIR);
     $fp = fopen(VAR_DIR . $ip . '-debug.html', 'w+');
     fwrite($fp, $header);
     fwrite($fp, $report);
     fwrite($fp, $footer);
     fclose($fp);
     return $js_window;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:19,代码来源:debug.class.php

示例10: cp

  function cp($src, $dest, $as_child = false, $exclude_regex = '', $include_hidden = false)
  {
  	$src = fs :: clean_path($src);
  	$dest = fs :: clean_path($dest);
  	
    if (!is_dir($src))
    {
			debug :: write_error('no such a directory',
			 __FILE__ . ' : ' . __LINE__ . ' : ' .  __FUNCTION__,
			array('dir' => $src));

    	return false;
    }
    
    if(!fs :: mkdir($dest))
    	return false;
    	
    $separator = fs :: separator();
    
    if ($as_child)
    {
    	$separator_regex = preg_quote($separator);
      if (preg_match( "#^.+{$separator_regex}([^{$separator_regex}]+)$#", $src, $matches))
      {
        fs :: _do_mkdir($dest . $separator . $matches[1], 0777);
        $dest .= $separator . $matches[1];
      }
      else
      	return false;//???
    }
    $items = fs :: 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))
        {
          fs :: _do_mkdir($dest . $separator . $item, 0777);
          
          $new_items = fs :: 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,代码行数:60,代码来源:fs.class.php

示例11: rm

 function test_mkdir_relative_path_no_trailing_slash()
 { 
 	fs :: rm(TEST_DIR_RELATIVE_PATH . '/tmp/');
 	
 	$this->assertFalse(is_dir(TEST_DIR_RELATIVE_PATH . '/tmp/wow/hey/'));
 	
 	fs :: 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,代码来源:fs_test.class.php

示例12: mkdir

 function _write_simple_cache($file_id, $contents)
 {
   fs :: mkdir(PAGE_CACHE_DIR);
   $f = fopen(PAGE_CACHE_DIR . $file_id, 'w');
   fwrite($f, $contents);
   fclose($f);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:7,代码来源:full_page_cache_manager_test.class.php

示例13: mkdir

 function cache_registry()
 {
   $this->session_id = session_id();
   fs :: mkdir(CACHE_DIR);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:5,代码来源:cache_registry.class.php

示例14: set_cache_dir

 /**
  * Set a cache dir
  * 
  * @param string $cache_dir 
  * @access public 
  */
 function set_cache_dir($cache_dir)
 {
     $this->_cache_dir = $cache_dir;
     fs::mkdir($this->_cache_dir);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:11,代码来源:cache_lite.class.php

示例15: mkdir

  function get_cache_size()
  {
    fs :: mkdir(IMAGE_CACHE_DIR);

    $files = fs :: find_subitems(IMAGE_CACHE_DIR, 'f');

    $size = 0;

    foreach($files as $file)
    {
      $size += (filesize($file));
    }

    return $size;
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:15,代码来源:image_cache_manager.class.php


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