php常用ip转换与文件下载代码

 更新时间:2016年11月25日 15:51  点击:1389

php教程常用ip转换与文件下载代码

ip转换
php中将ip转换成整型的函数ip2long()容易出现问题,在ip比较大的情况下,会变成负数。

<?php
$ip = "192.168.1.2";
$ip_n = ip2long($ip);
echo $ip_n;      //得到 -1062731518
?>


由于ip转换成的整型值太大超出了整型的范围,所以变成负数。需写成$ip_n = bindec(decbin(ip2long($ip)));这样便可得到无符号的整型数,如下

<?php
$ip = "192.168.1.2";
$ip_n = bindec(decbin(ip2long($ip)));
echo $ip_n;      //得到 3232235778
?>

文件下载代码

<?php
header("content-type: application/force-download");
header("content-disposition: attachment; filename=ins.jpg");
readfile("imgs/test_zoom.jpg");
?>

第一行代码是强制下载;

第二行代码是给下载的内容指定一个名字;

第三行代码是把下载的内容读进文件中。

 

example #1 forcing a download using readfile()

 

<?php
$file = 'monkey.gif';

if (file_exists($file)) {
    header('content-description: file transfer');
    header('content-type: application/octet-stream');
    header('content-disposition: attachment; filename='.basename($file));
    header('content-transfer-encoding: binary');
    header('expires: 0');
    header('cache-control: must-revalidate, post-check=0, pre-check=0');
    header('pragma: public');
    header('content-length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}
?>

 

 
今天在做一个api增量的功能的时候出现了一个特别奇怪的问题。我用curl 想tomcat post数据的时候,tomcat竟然报错,所我post的数据
没有正确或得。但是,我用curl post给我自己写的一个页面,就可以在$_post数组中获得数据。
为什么会出现这种问题那?
原因是在构建post 数据的数量出现问题。。。
1 function api_notice_increment($url, $data)
2 {
3 $ch = curl_init();
4 curl_setopt($ch, curlopt_header,0);
5 curl_setopt($ch, curlopt_returntransfer, 1);
6
7 curl_setopt($ch, curlopt_url, $url);
8 curl_setopt($ch, curlopt_post, 1);
9 curl_setopt($ch, curlopt_postfields, $data);
10 $lst['rst'] = curl_exec($ch);
11 $lst['info'] = curl_getinfo($ch);
12 curl_close($ch);
13 return $lst;
14 }
15 $url = "http://localhost/test/post.api.php教程?app=test&act=testact";
16 $data = array (
17 'goods_id' => '1010000001224',
18 'store_id' => '20708',
19 'status' => 'goodsdownshelf',
20 );
//post.api.php的代码
<?php
error_log(var_export($_post,1),3,'d:/post.txt');
执行上面的代码,在我的d:/生成的post.txt文件,其内容如下:
array (
  'goods_id' => '1010000001224',
  'store_id' => '20708',
  'status' => 'goodsdownshelf',
)
说明post的数据可以正常的获得。
修改上的代码
1 <?php
2  function api_notice_increment($url, $data)
3 {
4 $ch = curl_init();
5 curl_setopt($ch, curlopt_header,0);
6 curl_setopt($ch, curlopt_returntransfer, 1);
7
8 curl_setopt($ch, curlopt_url, $url);
9 curl_setopt($ch, curlopt_post, 1);
10 $data = http_build_query($data);
11 curl_setopt($ch, curlopt_postfields, $data);
12 $lst['rst'] = curl_exec($ch);
13 $lst['info'] = curl_getinfo($ch);
14 curl_close($ch);
15 return $lst;
16 }
17 $url = "http://localhost/test/post.api.php?app=test&act=testact";
18 $data = array (
19 'goods_id' => '1010000001224',
20 'store_id' => '20708',
21 'status' => 'goodsdownshelf',
22 );
23
24
25 api_notice_increment($url,$data);
只是在执行 curl_setopt($ch, curlopt_postfields, $data);之前执行下$data = http_build_query($data);操作。
删除d:/post.txt文件
再次运行。
再次打开d:/post.txt文件,其内容如下:
array (
  'goods_id' => '1010000001224',
  'store_id' => '20708',
  'status' => 'goodsdownshelf',
)
如果不将$data 进行http_build_query的话,java代码就不能获得post的数据,http_build_query以后就可以正常的获得了。

<style type="text/css教程"> 二款php教程分页实例代码
a.pagecool,.pagecoolselect,.pagecoolpre,.pagecoolnext,.pageinfo,.curtotalx,.pagecoolprex,.pagecoolnextx{float:left;height:20px;font-family:arial,宋体;color:#444;font-weight:bold}
a.pagecool,.pagecoolselect{width:22px;height:18px;font-weight:bold;border:#ccc 1px solid;margin:0 3px 0 3px;text-align:center;line-height:18px}
a.pagecool{text-decoration:none;color:#444;background:#fbf9f9;display:block}
a.pagecool:hover,.pagecoolselect{color:#f00;background:#ffc}
.pagecoolpre,.pagecoolnext{margin:0 8px 0 8px}
.pageinfo{line-height:20px;margin:0 0 0 8px;font-family:verdana,arial}
.pageinfo span{color:#f60}
.pagecoolprex,.pagecoolnextx{margin:0 0 0 5px}
.curtotalx{color:#666;line-height:20px;margin:0 2px 0 0;font-weight:normal;font-family:verdana,arial;text-align:right}
</style>
<?php
!function_exists('cdstr') && exit('forbidden');
class wrzc_netpage {
 private $page_name="p";
 private $pagesize=10;//每页显示记录条数
 private $total=0;//总的记录数
 private $pagebarnum=10;//bar数。
 private $totalpage=0;
 private $linkhead="";//url地址头
 private $current_pageno=1;//当前页
 public function __construct($total,$pagesize=10) {  
  if((!is_int($total))||($total<0))die("记录总数错误!");
  if((!is_int($pagesize))||($pagesize<0))die("pagesize错误!");
  $this->set("total",$total);
  $this->set("pagesize",$pagesize);
  $this->set('totalpage',ceil($total/$pagesize));
 }
 public function set($var,$value){
  if(in_array($var,get_object_vars($this)))
     $this->$var=$value;
  else {
    throw new pb_page_exception("error in set():".$var." does not belong to pb_page!");
  }
 }
 public function get_linkhead() {
  $this->set_current_page();
  if(empty($_server['query_string'])){
    $this->linkhead=$_server['request_uri']."?".$this->page_name."=";
  }else{
   if(isset($_get[$this->page_name])){                               
     $this->linkhead=str_replace($this->page_name.'='.$this->current_pageno,$this->page_name.'=',$_server['request_uri']);
   } else {
     $this->linkhead=$_server['request_uri'].'&'.$this->page_name.'=';
   }
  }
 }
 /*为指定的页面返回地址值*/
 public function get_url($pageno=1){
  if(empty($this->linkhead))$this->get_linkhead();
  return str_replace($this->page_name.'=',$this->page_name.'='.$pageno,$this->linkhead);
 }
 /*当前页*/
 public function set_current_page($current_pageno=0) {
  if(empty($current_pageno)){
   if(isset($_get[$this->page_name])){$this->current_pageno=intval($_get[$this->page_name]);}
  }else{
   $this->current_pageno=intval($current_pageno);
  }
  if ($this->current_pageno>$this->totalpage) header("location:./");//$this->current_pageno=1
 }
 public function set_format($str) {return $this->format_left.$str.$this->format_right;}
 /* 获取显示"下一页"*/
 public function next_page() {
  if($this->current_pageno<$this->totalpage){
   return '<a href="'.$this->get_url($this->current_pageno+1).'">'.$this->next_page.'</a>';
  }
  return '';
 }
 /*获取显示“上一页”*/
 public function pre_page() {
  if($this->current_pageno>1){return '<a href="'.$this->get_url($this->current_pageno-1).'">'.$this->pre_page.'</a>';}
  return '';
 }
 /*获取显示“首页”*/
 public function first_page() {return '<a href="'.$this->get_url(1).'">'.$this->first_page."</a>";}
 /*获取显示“尾页”*/
 public function last_page() {return '<a href="'.$this->get_url($this->totalpage).'">'.$this->last_page.'</a>';}
 public function nowbar() {
  if ($this->totalpage > 1){
   $begin=$this->current_pageno-ceil($this->pagebarnum/2);
   $begin=($begin>=1)?$begin:1;
   $return='';
   for($i=$begin;$i<$begin+$this->pagebarnum;$i++){
    if($i<=$this->totalpage){
     if($i!=$this->current_pageno){
      $return.="<a href=".$this->get_url($i)." class=pagecool>".$i.'</a>';
     }else {
      $return.='<div class=pagecoolselect>'.$i.'</div>';
     }
    }else{
     break;
    }
   }
   unset($begin);
  } 
  return $return;
 }
 /*“上一页”*/
 public function pre_bar() {
  if($this->current_pageno>ceil($this->pagebarnum/2)){
    $pageno=$this->current_pageno-$this->pagebarnum;
    if($pageno<=0)$pageno=1;
    return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->pre_bar."</a>");
  }
  return $this->set_format('<a href="'.$this->get_url(1).'">'.$this->pre_bar."</a>");
 }
 /*“下一页”*/
 public function next_bar() {
  if($this->current_pageno<$this->totalpage-ceil($this->pagebarnum/2)){
    $pageno=$this->current_pageno+$this->pagebarnum;
    return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->next_bar."</a>");
  }
  return $this->set_format('<a href="'.$this->get_url($this->totalpage).'">'.$this->next_bar."</a>");
 }
 /*跳转*/
 public function select() {
  $return='<select name="pb_page_select" onchange="window.location.href=''.$this->linkhead.''+this.options[this.selectedindex].value">';
  for($i=1;$i<=$this->totalpage;$i++){
   if($i==$this->current_pageno){
     $return.='<option value="'.$i.'" selected>'.$i.'</option>';
   }else{
     $return.='<option value="'.$i.'">'.$i.'</option>';
   }
  }
  $return.='</select>';
  return $return;
 }
 public function pagebar($mode=1){
  global $global;
  $this->set_current_page();
  $this->get_linkhead();
  //return ("共有<font color=red><b>".$this->total."</b></font>条记录。");
  switch ($mode) {
   case 1:
    $this->pre_page='<img src='.$global['www_2domain'].'/images/precool.gif title=上一页 class=pagecoolpre>';
    $this->next_page='<img src='.$global['www_2domain'].'/images/nextcool.gif title=下一页 class=pagecoolnext>';
    return $this->pre_page().$this->nowbar().$this->next_page().'<div class=pageinfo>第<span>'.$this->current_pageno.'</span>页 / 共<span>'.$this->totalpage.'</span>页</div>';
   break;
   case 2:
    $this->pre_page='<img src='.$global['www_2domain'].'/images/precoolx.gif title=上一页 class=pagecoolprex>';
    $this->next_page='<img src='.$global['www_2domain'].'/images/nextcool.gif title=下一页 class=pagecoolnextx>';
    return '<div class=curtotalx>'.$this->current_pageno.'/'.$this->totalpage.'</div>'.$this->pre_page().$this->next_page();
    //return '<div class=curtotalx>'.$this->total.'/'.$this->current_pageno.'/'.$this->totalpage.'</div>'.$this->pre_page().$this->next_page();
   break;
   case 3:
    $this->pre_page='<img src='.$global['www_2domain'].'/images/precoolx.gif title=上一页 class=pagecoolprex>';
    $this->next_page='<img src='.$global['www_2domain'].'/images/nextcool.gif title=下一页 class=pagecoolnextx>';
    return '<div class=curtotalx>第'.$this->current_pageno.'页/共'.$this->totalpage.'页</div>'.$this->pre_page().$this->next_page();
   break;
  }
 }
}
?>

代码二

<?php
!function_exists('cdstr') && exit('forbidden');
class uobarpage {
 private $page_name="p";//page标签,用来控制url页。比如说xxx.php?pb_page=2中的pb_page
 private $pagesize=10;//每页显示记录条数
 private $total=0;//总的记录数
 private $pagebarnum=10;//控制记录条的个数。
 private $totalpage=0;//总页数
 private $linkhead="";//url地址头
 private $current_pageno=1;//当前页
 /**
  * 显示符号设置
  */
 private $next_page='>';//下一页
 private $pre_page='<';//上一页
 private $first_page='first';//首页
 private $last_page='last';//尾页
 private $pre_bar='<<';//上一分页条
 private $next_bar='>>';//下一分页条
 private $format_left=' [';
 private $format_right='] ';
 
 public function __construct($total,$pagesize=10) {  
  if((!is_int($total))||($total<0))die("记录总数错误!");
  if((!is_int($pagesize))||($pagesize<0))die("pagesize错误!");
  $this->set("total",$total);
  $this->set("pagesize",$pagesize);
  $this->set('totalpage',ceil($total/$pagesize));
 }
       
 public function set($var,$value)
 {
   if(in_array($var,get_object_vars($this)))
      $this->$var=$value;
   else {
     throw new pb_page_exception("error in set():".$var." does not belong to pb_page!");
   }
 }
 
 /**
  * get the default url获取指定的url地址
  *
  */
/*
 public function get_linkhead() {
  $this->set_current_page();
  $this->linkhead=$_server['php_self']."?".$this->page_name."=";
 }
*/
 public function get_linkhead() {
  $this->set_current_page();
  if(empty($_server['query_string'])){
    $this->linkhead=$_server['request_uri']."?".$this->page_name."=";
  }else{
   if(isset($_get[$this->page_name])){                               
     $this->linkhead=str_replace($this->page_name.'='.$this->current_pageno,$this->page_name.'=',$_server['request_uri']);
   } else {
     $this->linkhead=$_server['request_uri'].'&'.$this->page_name.'=';
   }
  }
 }

 /**
  * 为指定的页面返回地址值
  */
 public function get_url($pageno=1)
 {
   if(empty($this->linkhead))$this->get_linkhead();
   return str_replace($this->page_name.'=',$this->page_name.'='.$pageno,$this->linkhead);
 }
 
 /**
  * 设置当前页面
  *
  */
 public function set_current_page($current_pageno=0) {
  if(empty($current_pageno)){
    if(isset($_get[$this->page_name])){
         $this->current_pageno=intval($_get[$this->page_name]);
    }
  }else{
    $this->current_pageno=intval($current_pageno);
  }
  if ($this->current_pageno>$this->totalpage) header("location:./");//////////$this->current_pageno=1////////////
 }
 
 public function set_format($str) {
   return $this->format_left.$str.$this->format_right;
 }

 /**
  * 获取显示"下一页"的代码
  *
  * @return string
  */
 public function next_page() {
   if($this->current_pageno<$this->totalpage){
     return ' <a href="'.$this->get_url($this->current_pageno+1).'">'.$this->next_page.'</a> ';
   }
   return '';
 }
 
 /**
  * 获取显示“上一页”的代码
  *
  * @return string
  */
 public function pre_page() {
   if($this->current_pageno>1){
     return '<a href="'.$this->get_url($this->current_pageno-1).'">'.$this->pre_page.'</a> ';
   }
   return '';
 }
 
 /**
  * 获取显示“首页”的代码
  *
  * @return string
  */
 public function first_page() {
   return '<a href="'.$this->get_url(1).'">'.$this->first_page."</a>";
 }
 
 /**
  * 获取显示“尾页”的代码
  *
  * @return string
  */
 public function last_page() {
   return '<a href="'.$this->get_url($this->totalpage).'">'.$this->last_page.'</a>';
 }
 
 //gyl1
 public function nowbar() {
   $begin=$this->current_pageno-ceil($this->pagebarnum/2);
   $begin=($begin>=1)?$begin:1;
   $return='';
   for($i=$begin;$i<$begin+$this->pagebarnum;$i++)
   {
     if($i<=$this->totalpage){
       if($i!=$this->current_pageno)
        $return.=' <a href="'.$this->get_url($i).'">'.'<span class=page1 onmouseo教程ver=this.style.background="ffffcc" onmouseout=this.style.background="fbf9f9"><b>'.$i.'</b></span>'.'</a> ';
       else
        $return.='<span class=page2><b>'.$i.'</b></span>';
     }else{
       break;
     }
   }
   unset($begin);
   return $return;
 }
 
 /**
  * 获取显示“上一分页条”的代码
  *
  * @return string
  */
 public function pre_bar()
 {
   if($this->current_pageno>ceil($this->pagebarnum/2)){
     $pageno=$this->current_pageno-$this->pagebarnum;
     if($pageno<=0)$pageno=1;
     return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->pre_bar."</a>");
   }
   return $this->set_format('<a href="'.$this->get_url(1).'">'.$this->pre_bar."</a>");
 }
 
 /**
  * 获取显示“下一分页条”的代码
  *
  * @return string
  */
 public function next_bar()
 {
   if($this->current_pageno<$this->totalpage-ceil($this->pagebarnum/2)){
     $pageno=$this->current_pageno+$this->pagebarnum;
     return $this->set_format('<a href="'.$this->get_url($pageno).'">'.$this->next_bar."</a>");
   }
   return $this->set_format('<a href="'.$this->get_url($this->totalpage).'">'.$this->next_bar."</a>");
 }
 
 /**
  * 获取显示跳转按钮的代码
  *
  * @return string
  */
 public function select()
 {
   $return='<select name="pb_page_select" onchange="window.location.href=''.$this->linkhead.''+this.options[this.selectedindex].value">';
   for($i=1;$i<=$this->totalpage;$i++)
   {
     if($i==$this->current_pageno){
       $return.='<option value="'.$i.'" selected>'.$i.'</option>';
     }else{
       $return.='<option value="'.$i.'">'.$i.'</option>';
     }
   }
   $return.='</select>';
   return $return;
 }
 
 /**
  * 获取mysql教程 语句中limit需要的值
  *
  * @return string
  */
 public function limit2(){
   //return ("共有<font color=red><b>".$this->total."</b></font>条记录。");
   //return ('共有<font color=red>'.$this->total.'</font>条记录。第<font color=red>'.$this->current_pageno)."</font>页/共<font color=red>".$this->totalpage.'</font>页';
   return ('<span style="height:20px;padding-top:3px;">共<b>'.$this->current_pageno.' / '.$this->totalpage.'</b>页</span>');
 }
 public function pagebar($mode=1)
 {  global $global;
   $this->set_current_page();
   $this->get_linkhead();
   switch ($mode)
   {
     case '1':
       $this->next_page='<img src='.$global['www_2domain'].'/images/next.gif border=0 align=absmiddle alt=下一页>';
       $this->pre_page='<img src='.$global['www_2domain'].'/images/pre.gif border=0 align=absmiddle alt=上一页>';
       return $this->pre_page().$this->nowbar().$this->next_page();
       //return $this->pre_page().$this->nowbar().$this->next_page().'第'.$this->select().'页';
       break;
   }
   
 }
}
?>

function getip() {
 if(getenv('http_client_ip') && strcasecmp(getenv('http_client_ip'), 'unknown')) {
  $onlineip = getenv('http_client_ip');
 } elseif(getenv('http_x_forwarded_for') && strcasecmp(getenv('http_x_forwarded_for'), 'unknown')) {
  $onlineip = getenv('http_x_forwarded_for');
 } elseif(getenv('remote_addr') && strcasecmp(getenv('remote_addr'), 'unknown')) {
  $onlineip = getenv('remote_addr');
 } elseif(isset($_server['remote_addr']) && $_server['remote_addr'] && strcasecmp($_server['remote_addr'], 'unknown')) {
  $onlineip = $_server['remote_addr'];
 }
 $onlineip = preg_replace("/^([d.]+).*/", "1", $onlineip);
 return $onlineip;
}

function htmlout($str){
 $guest=$str;
 $guest=str_replace("&","&amp;",$guest);
 $guest=str_replace("  "," ",$guest);
 //$guest=str_replace(" ","&nbsp;",$guest);
 $guest=str_replace(" "," ",$guest);
 //$guest=htmlspecialchars($guest);
 $guest=str_replace(">","&gt;",$guest);
 $guest=str_replace("<","&lt;",$guest);
 $guest=str_replace("rn","<br>",$guest);
 $guest=str_replace("'","&#039;",$guest);
 $guest=str_replace(""","&quot;",$guest);
 return($guest);
}
function badstr ($str,$to='*') {
 global $global;
 $from = $str;
 $rg_banname=$global['m_badwords'];
 $rg_banname=explode(',',$rg_banname);
 foreach($rg_banname as $value){
  if(strpos($str,$value)!==false){
   //$from = strtr($str,$value,$to);
   $from = str_replace($value,$to,$from);
  }
 }
 return($from);
}
function mkpath($mkpath,$mode=0777){
    $path_arr=explode('/',$mkpath);
    foreach ($path_arr as $value){
        if(!empty($value)){
            if(empty($path))$path=$value;
            else $path.='/'.$value;
            is_dir($path) or mkdir($path,$mode) or chmod($path,$mode);
        }
    }
    if(is_dir($mkpath))return true;
    return false;
}
function daddslashes($string, $force = 0) {
 global $magic_quotes_gpc;
 if(!$globals['magic_quotes_gpc'] || $force || $magic_quotes_gpc) {
  if(is_array($string)) {
   foreach($string as $key => $val) {
    $string[$key] = daddslashes($val, $force);
   }
  } else {
   $string = addslashes($string);
  }
 }
 return $string;
}
function dhtmlspecialchars($string) {
 if(is_array($string)) {
  foreach($string as $key => $val) {
   $string[$key] = dhtmlspecialchars($val);
  }
 } else {
  $string = preg_replace('/&amp;((#(d{3,5}|x[a-fa-f0-9]{4})|[a-za-z][a-z0-9]{2,5});)/', '&1',
  str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $string));
 }
 return $string;
}
function trimm ($str) {
 $str = trim(str_replace(" "," ",$str));
 //$str = str_replace("'","‘",$str);
 return $str;
}
function cdstr($length) {
 $possible = "0123456789";
 $str = "";
 while(strlen($str) < $length) $str .= substr($possible, (rand() % strlen($possible)), 1);
 return($str);
}
function cdstrletters($length) {
 $possible = "abcdefghijklmnopqrstuvwxyz";
 $str = "";
 while(strlen($str) < $length) $str .= substr($possible, (rand() % strlen($possible)), 1);
 return($str);
}
function cdnumletters($length) {
 $possible = "0123456789abcdefghijklmnopqrstuvwxyz";
 $str = "";
 while(strlen($str) < $length) $str .= substr($possible, (rand() % strlen($possible)), 1);
 return($str);
}

// date_format2($rs['time'],'%y年%m月%d日%h时%m分%s秒');
function date_format2($string, $format='%b %e, %y', $default_date=null)
{
    if (substr(php教程_os,0,3) == 'win') {
           $_win_from = array ('%e',  '%t',       '%d');
           $_win_to   = array ('%#d', '%h:%m:%s', '%m/%d/%y');
           $format = str_replace($_win_from, $_win_to, $format);
    }
    if($string != '') {
        return strftime($format, smarty_make_timestamp($string));
    } elseif (isset($default_date) && $default_date != '') {
        return strftime($format, smarty_make_timestamp($default_date));
    } else {
        return;
    }
}
function smarty_make_timestamp($string){
    if(empty($string)) {
        $string = "now";
    }
    $time = strtotime($string);
    if (is_numeric($time) && $time != -1)
        return $time;
    if (preg_match('/^d{14}$/', $string)) {
        $time = mktime(substr($string,8,2),substr($string,10,2),substr($string,12,2),
               substr($string,4,2),substr($string,6,2),substr($string,0,4));

        return $time;
    }
    $time = (int) $string;
    if ($time > 0)
        return $time;
    else
        return time();
}

[!--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
  • 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
  • C# 向二进制文件进行读写的操作方法

    该例子使用 BinaryStream 和 BinaryWriter 对二进制文件进行读写操作先上代码再根据我理解的所分享给各位朋友...2020-06-25