php目录 文件在线解压缩程序

 更新时间:2016年11月25日 15:53  点击:1524
本文章提供一款完整的php目录 文件在线解压缩程序,他可打包指定目录并且把目录下所有目录与文件名都打包好,按rar的方式打包,目录结构不变,同时也提供解压功能。

$fz = new fmzip;
$fz->setzipname("打包文件名");

#打包/压缩
$fz->setsource("待打包目录");
$fz->compress($silent,$compress);

#解包/解压
$fz->settarget("待解包目录");
$fz->uncompress($silent);
*/
class fmzip
{

var $source; //压缩源
var $target; //解压目的文件夹
var $zipname;//压缩文件名
var $handle; //打开压缩文件的句柄
var $silent; //是否输出
var $count_dir; //计数器_文件夹
var $count_file;//计数器_文件
var $dirlist;

function setsource($source)//设置压缩源
{
  if(!file_exists($source))
    die("source <$source> does not exist.");
  $this->source = $source;
}

function settarget($target)//设置解压目的文件夹
{
  if(!file_exists($target))
    $this->makedir($target);
  chdir(dirname($_server['script_filename']));
  if(substr($target,-1)=="/")
    $target = substr($target,0,strlen($target)-1);
  if(!file_exists($target))
  {
    die("target <$target> does not exist.");
  }
  $this->target = $target;
}

function setzipname($zipname)//设置压缩文件名
{
  if(empty($zipname)) $zipname = "fmzip.fz";
  $this->zipname = $zipname;
}

function compress($silent = false, $compress = true) //压缩
{
  $this->silent = $silent;
  if($silent===false)echo "<pre>compressing...rn";
  if(is_file("$this->zipname"))unlink("$this->zipname");
  $this->handle = fopen($this->zipname,"w");//创建压缩文件
  if($this->handle == null) die("error creating $this->zipname");//打开失败
  $this->count_dir = 0; $this->count_file = 0; //初始化计数器
  $this->merge($this->source);//压缩
  fwrite($this->handle,"-1");//结束标志
  fclose($this->handle);//关闭文件
  echo "rndirectory: $this->count_dir";
  echo "rnfile: $this->count_filern";
  if(function_exists("gzcompress") && $compress==true)
  {
    file_put_contents("$this->zipname.gz",gzcompress(file_get_contents("$this->zipname")));
    unlink("$this->zipname");
  }
  if($silent===false)
  {
    echo $this->listfile();
    echo "</pre>";
  }
}

function listfile()
{
  if(file_exists("$this->zipname.gz"))
    return "<a href="$this->zipname.gz" target="_blank">download $this->zipname.gz</a>";
  if(file_exists("$this->zipname"))
    return "<a href="$this->zipname" target="_blank">download $this->zipname</a>";
}

function merge($dir)//合并文件、文件夹(递归)
{
/* 说明:不处理link。 */
 if(is_dir($dir))//如果压缩源是文件夹
 {
  $list = scandir($dir);//扫描文件列表
  natcasesort($list);
  foreach($list as $file)//先处理文件夹
  {
    $full = "$dir/$file";
    if(!is_dir($full)||$file=="."||$file=="..")continue;//只处理文件夹
    $this->count_dir++;
    if($this->silent===false)
      echo "[dir] $fullrn"; //输出提示
    fwrite($this->handle,$this->file_info($full));//写入文件夹信息
    $this->merge($full);//递归合并下级文件夹
  }//文件夹处理完毕;
  foreach($list as $file)//处理文件
  {
    $full = "$dir/$file";
    if(!is_file($full)||$file=="."||$file=="..")continue; //只处理文件
    $this->count_file++;
    if($this->silent===false)
      echo "[file] $fullrn";//输出提示
    fwrite($this->handle,$this->file_info($full));//写入文件信息
  }//文件处理完毕
 }
 else
 {
   $this->count_file++;
   if($this->silent===false)echo "[file] $fullrn";//输出提示
   fwrite($this->handle,$this->file_info($file));//写入文件信息
 }
}//end function merge

function file_info($file)
{
  $perm = substr(sprintf('%o',fileperms($file)), -3); //权限
  $filename = str_replace($this->source,"",$file);
  if(is_file($file))//文件
  {
    $size = filesize($file); //文件大小
    return "1rn$filenamern$permrn$sizern".file_get_contents($file)."rn";// .文件内容
  }
  if(is_dir($file))//目录
    return "0rn$filenamern$permrn";
}//end function file_info

function uncompress($silent = false)
{
  $this->silent = $silent;
  if($silent===false)echo "<pre>uncompressing...rn";
  if(substr($this->zipname,-3)==".gz")
    $this->zipname = substr($this->zipname,0,strlen($this->zipname)-3);
  if(file_exists("$this->zipname.gz"))
  {
    if(!function_exists(gzuncompress))
      die("function gzuncompress is not supported. unable to continue.");
    file_put_contents($this->zipname,gzuncompress(file_get_contents("$this->zipname.gz")));
  }
  $this->handle = fopen($this->zipname,"r");
  if($this->handle == null) die("error reading $this->zipname");//打开失败
  $count = 0;
  while(1)
  {
    $count ++;
    $type = $this->read_line(); //读取类型
    if($type === "-1")break;//处理完毕,退出
    $filename = $this->target.$this->read_line();//读取文件名
    $permission = $this->read_line();//读取权限
/* <文件夹> [0]n[file_name]n[perm]n */
    if($type === "0")//目录
    {
      if($this->silent === false)//输出提示
        echo "[dir] $filename  [$permission]rn";
      $this->makedir($filename);//创建文件夹
      chdir(dirname($_server['script_filename']));
      chmod($filename,$permission);
      $this->dirlist[$filename] = 1;
      continue;
    }
/* <文件> [1]n[file_name]n[perm]n[size]n[contents]n */
    if($type === "1")//文件
    {
      $this->count_file++;
      $size = $this->read_line(); //读取文件大小
      if($this->silent === false)//输出提示
        echo "[file] $filename  [$permission] [size = $size]rn";
      if($size!=0)
      {
        $fp = fopen($filename,"w");
        $contents = fread($this->handle,$size);
        fwrite($fp,$contents);
        fclose($fp);
        chmod($filename,$permission);
      }
      $this->read_line();//内容后的一个回车
      continue;
    }
  }
  $this->count_dir = count($this->dirlist);
  if($silent===false)
    echo "ndirectory: $this->count_dir";
    echo "nfile: $this->count_filen</pre>n";
  fclose($this->handle);
  if(file_exists("$this->zipname.gz"))unlink("$this->zipname");
}//end function uncompress;

function read_line()
{
  $a = fgets($this->handle);
  $a = str_replace("rn","",$a);
  $a = str_replace("n","",$a);
  return $a;
}

function makedir($full)
{
  list($a,$b) = split("/",$full,2);
  if($a == "") return;
  if(file_exists($a)&&!is_dir($a))die("can't create dir $a");
  if(!file_exists($a))@mkdir($a);
  chdir($a);
  if($b!=="")
    $this->makedir($b);
  chdir("..");
}//end function makedir

} //end class fmzip

/*

使用方法:

#必须
include("包含这个class的php文件");
$fz = new fmzip;
$fz->setzipname("打包文件名");

#打包/压缩
$fz->setsource("待打包目录");
$fz->compress($silent,$compress);

#解包/解压
$fz->settarget("待解包目录");
$fz->uncompress($silent);

$silent : true|false (不加引号!) 是否产生输出 默认为true,不产生
$compress : true|false (不加引号!) 是否压缩 默认为true,压缩

 在php中有很多方法来把目录所有文件列出的代码,用e
*/

$list = scandir(".");
    $zipname = "";
    foreach($list as $file)
    {
      if($file=="."||$file=="..")continue;
      $b=substr($file,-3);
      if($b==".gz"||$b==".fz")
      { $zipname = $file; break; }
    }
 
//代码二

$d=dir(".");
echo $d->path.$e;
while(false !== ($e= $d->read())) {
    echo "<a href=$e target=_blank >$e</a>"."<br>";
    }
$d->close();


//最简单的方法

$dirs    = array();
foreach(glob("test/*") as $d)
{
    if(is_dir($d))
    {
        $dirs[]    = $d;
    }
}
print_r($dirs);

//方法四

glob("test/*", glob_onlydir) ;

//方法五

function clean_dir($path)        {
        if (!is_dir($path))        {
                if (is_file($path))        {
                        unlink($path);
                }
                return;
        }
        $p=opendir($path);
        while ($f=readdir($p))        {
                if ($f=="." || $f=="..") continue;
                clean_dir($path.$f);
        }
        rmdir($path);
        return;
}

这里把数据库中的常用的内容保存到一个标准的php格式的文件当中,这样使用起来也方便了很多,下面代码。

$res=mysql教程_query("select k1,k2  from ".table('keywords')." ") ;
$str="<?php rn ";
while($rs=mysql_fetch_array($res))
{
 
 $str .="$keyword['".$rs[0]."']='".$rs[1]."';rn";
}
$str.="?>";
file_put_contents("keyword.php",$str);
echo "导出成功";

//方法二

$f=file_get_contents("w1.txt");
$f=str_replace("rn","<br>",$f);//替换换行符
$arr=explode("<br>",$f);
$str="<?php rn ";
foreach($arr as $t)
{
 $rs=explode("|",$t);
 //不能包含?等特殊符号
 $str .="$keyword['".str_replace("?","",$rs[0])."']='".str_replace("?","",$rs[1])."';rn";
 
}
$str.="?>";
file_put_contents("keyword.php",$str);
echo "导出成功";

//conn.php文件
$conn=mysql_connect($mysql_host,$mysql_user,$mysql_password) or die('连接服务器出错');
mysql_select_db($mysql_db) or die("选择数据库出错");
mysql_query("set names 'gbk'");
function table($t)
{
 global $mysql_table_prefix;
 return $mysql_table_prefix.$t;
}
?>

这是一款老外写的mysql php接受数据过来然后进行数据保存在mysql_real_escape_string(nl2br(strip_tags($_POST[\'comment\'])));我觉得写得我们有一点区别吧。

database config
 */

 代码如下 复制代码

$db_host  = 'localhost';
$db_user  = 'root';
$db_pass  = '';
$db_database = '';

$link = mysql_connect($db_host,$db_user,$db_pass) or die('unable to establish a db connection');

mysql_select_db($db_database,$link);
mysql_query("set names utf8");


if(empty($_post['comment'])) die("0");
// if there isn't a comment text, exit

$comment = mysql_real_escape_string(nl2br(strip_tags($_post['comment'])));
$user='demo';
// this would be a nice place to start customizing - the default user
// you can integrate it to any site and show a different username.

$addon='';
if($_post['parent']) $addon=',parent='.(int)$_post['parent'];

mysql_query("insert into wave_comments set usr='".$user."', comment='".$comment."', dt=now()".$addon);

if(mysql_affected_rows($link)==1)
 echo mysql_insert_id($link);
 // if the insert was successful, echo the newly assigned id
else
 echo '0';
?>

sql

--
-- table structure for table `wave_comments`
--

create table `wave_comments` (
  `id` int(11) not null auto_increment,
  `parent` int(11) not null default '0',
  `usr` varchar(16) collate utf8_unicode_ci not null default '',
  `comment` text collate utf8_unicode_ci not null,
  `dt` datetime not null default '0000-00-00 00:00:00',
  primary key  (`id`),
  key `parent` (`parent`,`id`)
) engine=myisam  default charset=utf8 collate=utf8_unicode_ci;

--
-- dumping data for table `wave_comments`
--

insert into `wave_comments` values(1, 0, 'tutorialzine', 'this is a demo for a tutorialzine tutorial about creating a google wave-like history slider.<br /><br />rnto get started, just drag the slider above, and this thread will be reverted to a past state.', '2009-10-24 03:58:08');
insert into `wave_comments` values(2, 0, 'curious', 'is html allowed in the comments?', '2009-10-24 03:59:44');
insert into `wave_comments` values(3, 2, 'tutorialzine', 'nope. also the messages in this demo are deleted every hour to prevent spamming.', '2009-10-24 04:00:15');
insert into `wave_comments` values(4, 1, 'tutorialzine', 'in this tutorial we are using <b>php</b>, <b>mysql</b>, <b>jquery</b> and <b>css教程</b>. the slider was created with <b>jquery ui</b>. <a href="http://111cn.net/2009/10/google-wave-history-slider-jquery/" target="_blank">view the tutorial</a>.', '2009-10-24 04:01:34');
insert into `wave_comments` values(5, 2, 'curious', 'thanks! also i noticed that you can click, rather than drag the slider.great!', '2009-10-24 04:11:48');

本文章是利用了js php ajax css实现的一款可刷新的js 树形菜单,如果你正在找这类型的类型的树形菜单可以进来免费下载。
 代码如下 复制代码

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.111cn.net/tr/xhtml1/dtd/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>simpletree drag</title>
<style>
body
{
 font: normal 12px arial, tahoma, helvetica, sans-serif;
 margin:0;
 padding:20px;
}
.simpletree
{
 
 margin:0;
 padding:0;
 /*
 overflow:auto;
 width: 250px;
 height:350px;
 overflow:auto;
 border: 1px solid #444444;
 */
}
.simpletree li
{
 list-style: none;
 margin:0;
 padding:0 0 0 34px;
 line-height: 14px;
}
.simpletree li span
{
 display:inline;
 clear: left;
 white-space: nowrap;
}
.simpletree ul
{
 margin:0;
 padding:0;
}
.simpletree .root
{
 margin-left:-16px;
 background: url(images/root.gif) no-repeat 16px 0 #ffffff;
}
.simpletree .line
{
 margin:0 0 0 -16px;
 padding:0;
 line-height: 3px;
 height:3px;
 font-size:3px;
 background: url(images/line_bg.gif) 0 0 no-repeat transparent;
}
.simpletree .line-last
{
 margin:0 0 0 -16px;
 padding:0;
 line-height: 3px;
 height:3px;
 font-size:3px;
 background: url(images/spacer.gif) 0 0 no-repeat transparent;
}
.simpletree .line-over
{
 margin:0 0 0 -16px;
 padding:0;
 line-height: 3px;
 height:3px;
 font-size:3px;
 background: url(images/line_bg_over.gif) 0 0 no-repeat transparent;
}
.simpletree .line-over-last
{
 margin:0 0 0 -16px;
 padding:0;
 line-height: 3px;
 height:3px;
 font-size:3px;
 background: url(images/line_bg_over_last.gif) 0 0 no-repeat transparent;
}
.simpletree .folder-open
{
 margin-left:-16px;
 background: url(images/collaps教程able.gif) 0 -2px no-repeat #fff;
}
.simpletree .folder-open-last
{
 margin-left:-16px;
 background: url(images/collapsable-last.gif) 0 -2px no-repeat #fff;
}
.simpletree .folder-close
{
 margin-left:-16px;
 background: url(images/expandable.gif) 0 -2px no-repeat #fff;
}
.simpletree .folder-close-last
{
 margin-left:-16px;
 background: url(images/expandable-last.gif) 0 -2px no-repeat #fff;
}
.simpletree .doc
{
 margin-left:-16px;
 background: url(images/leaf.gif) 0 -1px no-repeat #fff;
}
.simpletree .doc-last
{
 margin-left:-16px;
 background: url(images/leaf-last.gif) 0 -1px no-repeat #fff;
}
.simpletree .ajax
{
 background: url(images/spinner.gif) no-repeat 0 0 #ffffff;
 height: 16px;
 display:none;
}
.simpletree .ajax li
{
 display:none;
 margin:0;
 padding:0;
}
.simpletree .trigger
{
 display:inline;
 margin-left:-32px;
 width: 28px;
 height: 11px;
 cursor:pointer;
}
.simpletree .text
{
 cursor: default;
}
.simpletree .active
{
 cursor: default;
 background-color:#f7be77;
 padding:0px 2px;
 border: 1px dashed #444;
}
#drag_container
{
 background:#ffffffwww.111cn.net;
 color:#000;
 font: normal 11px arial, tahoma, helvetica, sans-serif;
 border: 1px dashed #767676;
}
#drag_container ul
{
 list-style: none;
 padding:0;
 margin:0;
}

#drag_container li
{
 list-style: none;
 background-color:#ffffff;
 line-height:18px;
 white-space: nowrap;
 padding:1px 1px 0px 16px;
 margin:0;
}
#drag_container li span
{
 padding:0;
}

#drag_container li.doc, #drag_container li.doc-last
{
 background: url(images/leaf.gif) no-repeat -17px 0 #ffffff;
}
#drag_container .folder-close, #drag_container .folder-close-last
{
 background: url(images/expandable.gif) no-repeat -17px 0 #ffffff;
}

#drag_container .folder-open, #drag_container .folder-open-last
{
 background: url(/http://mb.111cn.net/collapsable.gif) no-repeat -17px 0 #ffffff;
}
.contextmenu
{
 display:none;
}
</style>
<script type="text/网页特效" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.simple.tree.js"></script>
<script type="text/javascript">
var simpletreecollection;
$(document).ready(function(){
 simpletreecollection = $('.simpletree').simpletree({
  autoclose: true,
  afterclick:function(node){
   //alert("text-"+$('span:first',node).text());
  },
  afterdblclick:function(node){
   //alert("text-"+$('span:first',node).text());
  },
  aftermove:function(destination, source, pos){
   //alert("destination-"+destination.attr('id')+" source-"+source.attr('id')+" pos-"+pos);
  },
  afterajax:function()
  {
   //alert('loaded');
  },
  animate:true
  //,doctofolderconvert:true
 });
});
</script>
</head>

<body>
<div class="contextmenu" id="mymenu1">
 <ul>
  <li id="add"><img src="images/folder_add.png" /> add child</li>
  <li id="reload"><img src="images/arrow_refresh.png" /> reload</li>
  <li id="edit"><img src="images/folder_edit.png" /> edit</li>
  <li id="delete"><img src="images/folder_delete.png" /> delete</li>
 </ul>
</div>
<div class="contextmenu" id="mymenu2">
 <ul>
  <li id="edit"><img src="images/page_edit.png" /> edit</li>
  <li id="delete"><img src="images/page_delete.png" /> delete</li>
 </ul>
</div>
<ul class="simpletree">
 <li class="root" id='1'><span>tree root 1</span>
  <ul>
   
   <li class="open" id='2'><span>tree node 1</span>
    <ul>
     
     <li id='3'><span>tree node 1-1</span>
      <ul class="ajax">
       <li id='4'>{url:loadtree.php?tree_id=1}</li>
      </ul>
     </li>
     
    </ul>
   </li>
   
   <li id='5'><span>tree node 2</span>
    <ul>
     
     <li id='6'><span>tree node 2-1</span>
      <ul>
       
       <li id='7'><span>tree node 2-1-1</span></li>
       
       <li id='8'><span>tree node 2-1-2</span></li>
       
       <li id='9'><span>tree node 2-1-3</span></li>
       
       <li id='10'><span>tree node 2-1-4www.aimeige.com.cn</span>
        <ul class="ajax">
         <li id='11'>{url:loadtree.php?tree_id=1}</li>
        </ul>
       </li>
       
      </ul>
     </li>
     
     <li id='12'><span>tree node 2-2</span>
      <ul>
       
       <li id='13'><span>tree node 2-2-1</span></li>
       
      </ul>
     </li>
     
     
     <li id='14'><span>tree node 2-3</span>
      <ul>
       
       <li id='15'><span>tree node 2-3-1</span>
         <ul>
          
          <li id='16'><span>tree node 2-3-1-1</span></li>
          
          <li id='17'><span>tree node 2-3-1-2</span></li>
          
          <li id='18'><span>tree node 2-3-1-3</span>
           <ul>
            
            <li id='19'><span>tree node 2-3-1-3-1</span></li>
            
           </ul>
          </li>
          
          <li id='20'><span>tree node 2-3-1-4</span></li>
          
          <li id='21'><span>tree node 2-3-1-5</span></li>
          
          <li id='22'><span>tree node 2-3-1-6</span>
           <ul>
            
            <li id='23'><span>tree node 2-3-1-6-1</span></li>
            
           </ul>
          </li>
          
          <li id='24'><span>tree node 2-3-1-7</span></li>
          
          <li id='25'><span>tree node 2-3-1-8</span></li>
          
          <li id='26'><span>tree node 2-3-1-9</span>
           <ul>
            
            <li id='27'><span>tree node 2-3-1-9-1</span></li>
            
           </ul>
          </li>
          
         </ul>
       </li>
       
      </ul>
     </li>
     
    </ul>
   </li>
   
  </ul>
 </li>
</ul>

</body>

</html>

php文件
<li id='35'><span class="text">tree node ajax 1</span></li>
<li id='36'><span class="text">tree node ajax 2</span></li>
<li id='37'><span class="text">tree node ajax 3</span>
 <ul>
  <li id='38'><span class="text">tree node ajax 3-1</span>
   <ul>
    <li id='39'><span class="text">tree node ajax 3-1-1</span></li>
    <li id='40'><span class="text">tree node ajax 3-1-2</span></li>
    <li id='41'><span class="text">tree node ajax 3-1-3</span></li>
    <li id='42'><span class="text">tree node ajax 3-1-4</span></li>
   </ul>
  </li>
  <li id='43'><span class="text">tree node ajax 3-2</span></li>
  <li id='44'><span class="text">tree node ajax 3-3</span>
   <ul>
    <li id='45'><span class="text">tree node ajax 3-3-1</span></li>
    <li id='46'><span class="text">tree node ajax 3-3-2</span></li>
    <li id='47'><span class="text">tree node ajax 3-3-3</span></li>
   </ul>
  </li>
  <li id='48'><span class="text">tree node ajax 3-4</span></li>
  <li id='49'><span class="text">tree node ajax 3-5</span>
   <ul>
    <li id='50'><span class="text">tree node ajax 3-5-1</span></li>
    <li id='51'><span class="text">tree node ajax 3-5-2</span></li>
    <li id='52'><span class="text">tree node ajax 3-5-3</span></li>
   </ul>
  </li>
  <li id='53'><span class="text">tree node ajax 3-6</span></li>
 </ul>
</li>
<li id='54'><span class="text">tree node ajax 4</span></li>

源码下载
http://down.111cn.net/down/code/jquery/2010/1014/21200.html
效果预览
http://g.111cn.net/javascript/code/20101012/tree

[!--infotagslink--]

相关文章

  • php读取zip文件(删除文件,提取文件,增加文件)实例

    下面小编来给大家演示几个php操作zip文件的实例,我们可以读取zip包中指定文件与删除zip包中指定文件,下面来给大这介绍一下。 从zip压缩文件中提取文件 代...2016-11-25
  • Jupyter Notebook读取csv文件出现的问题及解决

    这篇文章主要介绍了JupyterNotebook读取csv文件出现的问题及解决,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2023-01-06
  • Photoshop打开PSD文件空白怎么解决

    有时我们接受或下载到的PSD文件打开是空白的,那么我们要如何来解决这个 问题了,下面一聚教程小伙伴就为各位介绍Photoshop打开PSD文件空白解决办法。 1、如我们打开...2016-09-14
  • C#操作本地文件及保存文件到数据库的基本方法总结

    C#使用System.IO中的文件操作方法在Windows系统中处理本地文件相当顺手,这里我们还总结了在Oracle中保存文件的方法,嗯,接下来就来看看整理的C#操作本地文件及保存文件到数据库的基本方法总结...2020-06-25
  • 解决python 使用openpyxl读写大文件的坑

    这篇文章主要介绍了解决python 使用openpyxl读写大文件的坑,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2021-03-13
  • C#实现HTTP下载文件的方法

    这篇文章主要介绍了C#实现HTTP下载文件的方法,包括了HTTP通信的创建、本地文件的写入等,非常具有实用价值,需要的朋友可以参考下...2020-06-25
  • SpringBoot实现excel文件生成和下载

    这篇文章主要为大家详细介绍了SpringBoot实现excel文件生成和下载,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下...2021-02-09
  • Go语言压缩和解压缩tar.gz文件的方法

    这篇文章主要介绍了Go语言压缩和解压缩tar.gz文件的方法,实例分析了使用Go语言压缩文件与解压文件的技巧,具有一定参考借鉴价值,需要的朋友可以参考下...2020-05-03
  • php无刷新利用iframe实现页面无刷新上传文件(1/2)

    利用form表单的target属性和iframe 一、上传文件的一个php教程方法。 该方法接受一个$file参数,该参数为从客户端获取的$_files变量,返回重新命名后的文件名,如果上传失...2016-11-25
  • php批量替换内容或指定目录下所有文件内容

    要替换字符串中的内容我们只要利用php相关函数,如strstr,str_replace,正则表达式了,那么我们要替换目录所有文件的内容就需要先遍历目录再打开文件再利用上面讲的函数替...2016-11-25
  • PHP文件上传一些小收获

    又码了一个周末的代码,这次在做一些关于文件上传的东西。(PHP UPLOAD)小有收获项目是一个BT种子列表,用户有权限上传自己的种子,然后配合BT TRACK服务器把种子的信息写出来...2016-11-25
  • AI源文件转photoshop图像变模糊问题解决教程

    今天小编在这里就来给photoshop的这一款软件的使用者们来说下AI源文件转photoshop图像变模糊问题的解决教程,各位想知道具体解决方法的使用者们,那么下面就快来跟着小编...2016-09-14
  • C++万能库头文件在vs中的安装步骤(图文)

    这篇文章主要介绍了C++万能库头文件在vs中的安装步骤(图文),文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧...2021-02-23
  • Zend studio文件注释模板设置方法

    步骤:Window -> PHP -> Editor -> Templates,这里可以设置(增、删、改、导入等)管理你的模板。新建文件注释、函数注释、代码块等模板的实例新建模板,分别输入Name、Description、Patterna)文件注释Name: 3cfileDescriptio...2013-10-04
  • C#路径,文件,目录及IO常见操作汇总

    这篇文章主要介绍了C#路径,文件,目录及IO常见操作,较为详细的分析并汇总了C#关于路径,文件,目录及IO常见操作,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25
  • php文件上传你必须知道的几点

    本篇文章主要说明的是与php文件上传的相关配置的知识点。PHP文件上传功能配置主要涉及php.ini配置文件中的upload_tmp_dir、upload_max_filesize、post_max_size等选项,下面一一说明。打开php.ini配置文件找到File Upl...2015-10-21
  • C#使用StreamWriter写入文件的方法

    这篇文章主要介绍了C#使用StreamWriter写入文件的方法,涉及C#中StreamWriter类操作文件的相关技巧,需要的朋友可以参考下...2020-06-25
  • ant design中upload组件上传大文件,显示进度条进度的实例

    这篇文章主要介绍了ant design中upload组件上传大文件,显示进度条进度的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-10-29
  • php实现文件下载实例分享

    举一个案例:复制代码 代码如下:<?phpclass Downfile { function downserver($file_name){$file_path = "./img/".$file_name;//转码,文件名转为gb2312解决中文乱码$file_name = iconv("utf-8","gb2312",$file_name...2014-06-07
  • 查找php配置文件php.ini所在路径的二种方法

    通常php.ini的位置在:复制代码 代码如下:/etc目录下或/usr/local/lib目录下。如果你还是找不到php.ini或者找到了php.ini修改后不生效(其实是没找对),请使用如下办法:1.新建php文件,写入如下代码复制代码 代码如下:<?phpe...2014-05-31