php 接收与发送xml文件

 更新时间:2016年11月25日 16:55  点击:1341

 

接收xml:
$xml = file_get_contents('php://input');
 
发送(post):
$xml_data = <xml>...</xml>";
$url = http://dest_url
;
$header[] = "Content-type: text/xml";//定义content-type为xml
curl_setopt($ch, CURLOPT_URL, $url
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1
);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_POST, 1
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xml_data
);
$response = curl_exec($ch
);
if(
curl_errno($ch
))
{
    print
curl_error($ch
);
}
curl_close($ch);
 
或者:
$fp = fsockopen($server, 80);
fputs($fp, "POST $path HTTP/1.0rn");
fputs($fp, "Host: $serverrn");
fputs($fp, "Content-Type: text/xmlrn");
fputs($fp, "Content-Length: $contentLengthrn");
fputs($fp, "Connection: closern");
fputs($fp, "rn"); // all headers sent
fputs($fp, $xml_data);
$result = '';
while (!feof($fp)) {
$result .= fgets($fp, 128);
}
return $result;

 <?php
/*Khalid XML files parser :: class kxparse, Started in March 2002 by Khalid Al-kary*/
class kxparse{
var $xml;
var $cursor;
var $cursor2;

//the constructor $xmlfile is the file you want to load into the parser
function kxparse($xmlfile)
{
 //just read the file
 $file=fopen($xmlfile,"r");
 
 //put the text inside the file in the XML object variable
 while (!feof($file))
  {
   $this->xml.=fread($file,4096);  
  }
 
 //close the opened file
 fclose($file);

 //set the cursor to 0 (start of document), the cursor is later used by another functions
 $this->cursor=0;

 //set the second curosr to the end of document
 $this->cursor2=strlen($this->xml);
}

/*this function first gets a copy of the XML file starting from cursor and ending with cursor2
and then counts the number of occurences of the given tag name inside that area
returns an array (occurrence index -> occurence position in the XML file)
this function is half of the engine that moves Kxparse */
function track_tag_cursors($tname)
 {
  //getting the copy as intended
  $currxml=substr($this->xml,$this->cursor,$this->cursor2);
  
  //counting the number of occurences in the cut area
  $occurs=substr_count($currxml,"<".$tname);
  
  //the aray that will be returned
  $tag_poses=array();
  
  //setting its 0 to 0 because indeces in Kxparse start from 1
  $tag_poses[0]=0;
  
  //for each of the occurences
  for ($i=1;$i<=$occurs;$i++)
   {
    
    if ($i!=1)
     {
      //if it's not the first occurence
      //start checking for the next occurence but first cut the previous occurences off from the string
      $tag_poses[$i]=strpos($currxml,"<".$tname,$tag_poses[$i-1]+1-$this->cursor)+$this->cursor;
     }
    else
     {
      //if its the first occurence just assign its value + the cursor (because the position is in the XML file wholly
      $tag_poses[$i]=strpos($currxml,"<".$tname)+$this->cursor;
     }
     
   }
  
  //return that array 
  return $tag_poses;
 }
//this function strips and decodes the tag text...
function get_tag_text_internal($tname)
 {
  //strip the tags from the returned text and the decode it
  return $this->htmldecode(strip_tags($tname));
 }

//function that returns a particular attribute value ...
//tag is the tag itself(with its start and end)
function get_attribute_internal($tag,$attr)
 {
  //identifying the character directly after the tag name to cut it then
  if (strpos($tag," ")<strpos($tag,">"))
   {
    $separ=" ";
   }
  else
   {
    $separ=">";
   }

  //cutting of the tag name according to separ
  $tname=substr($tag,1,strpos($tag,$separ)-1);

  //cut the tag starting from the white space after the tag name, ending with(not containing) the > of the tag start
  $work=substr($tag,strlen($tname)+1,strpos($tag,">")-strlen($tname)-1);

  //get the index of the tag occurence inside $work
  $index_of_attr=strpos($work," ".$attr."="")+1;

  //check if the attribute was found in the tag
  if ($index_of_attr)
   {
    //now get the attributename+"=""+attrbutevalue+""" and extract the value from between them
    //calculate from where we will cut
    $index_of_value=$index_of_attr+strlen($attr)+2;

    //cut note the last argument for calculating the end
    $work=substr($work,$index_of_value,strpos($work,""",$index_of_value)-$index_of_value);

    //now return the attribute value
    return $work;
   }

   //if the attribute wasn't found, return false'
  else
   {
    return FALSE;
   }
 }


//this function HTML-decodes the var $text...
function htmldecode($text)
 {
  $text=str_replace("&lt;","<",$text);
  $text=str_replace("&gt;",">",$text);
  $text=str_replace("&amp;","&",$text);
  $text=str_replace("&ltt;","&lt;",$text);
  $text=str_replace("&gtt;","&gt;",$text);
  return $text;
 }

//the function that saves a file to a particular location
function save($file)
 {
  //open the file and overwrite of already avilable
  $my_file=fopen($file,"wb");

  //$my_status holds wether the operation is okay
  $my_status=fwrite($my_file,$this->xml);

  //close the file handle
  fclose($my_file);

  if ($my_status!=-1)
   {
    return TRUE;
   }
  else
   {
    return FALSE;
   }

 }

//function that gets a tag in the XML tree (with its starting and ending)
function get_tag_in_tree($tname,$tindex)
 {
  $this->get_work_space($tname,$tindex);
  return substr($this->xml,$this->cursor,$this->cursor2-$this->cursor);
 }
//function that gets the text of a tag
function get_tag_text($tname,$tindex)
{
 $mytag=$this->get_tag_in_tree($tname,$tindex);
 return $this->get_tag_text_internal($mytag);

//funtion that counts the number of occurences of a tag in the XML tree 
function count_tag($tname,$tindex)
 {
  return $this->get_work_space($tname,$tindex);
 }
 
//functoin that gets the attribute value in a tag 
function get_attribute($tname,$tindex,$attrname) 
 {
  $mytag=$this->get_tag_in_tree($tname,$tindex);
  return $this->get_attribute_internal($mytag,$attrname);
 }

//Very important function, half of the engine
//sets the $this->cursor and $this->cursor2 to the place where it's intended to work 
function get_work_space($tname,$tindex) 
 {
  //counts the number of ":"  in the given colonedtagindex
  $num_of_search=substr_count($tindex,":");
  
  //counts the number of ":" in the given colonedtagname
  $num_of_search_text=substr_count($tname,":");
  
  //checks if they are not equal this regarded an error
  if ($num_of_search!=$num_of_search_text)
   {
    return false;
   }
  else
   {
    //now get the numbers in an array
    $search_array=explode(":",$tindex);
    
    //and also get the corresponding tag names
    $search_text_array=explode(":",$tname);
    
    //set the cursor to 0 in order to erase former work
    $this->cursor=0;
    
    //set the cursor2 to the end of the file for the same reason
    $this->cursor2=strlen($this->xml);
    
    //get the first tag name to intiate the loop
    $currtname=$search_text_array[0];
    
    //get the first tag index to intiate the loop
    $currtindex=$search_array[0];
    
    //the loop according to number of ":"
    for ($i=0;$i<count($search_array);$i++)
     {
      //if it's not the first tag name and index
      if ($i!=0)
       {
        //so append the latest colonedtagname to the current tag name
        $currtname=$currtname.":".$search_text_array[$i];
        
        //and append the latset colonedtagindex to the current tag index
        $currtindex=$currtindex.":".$search_array[$i];
       }
      //$arr holds the number of occurences of the current tag name between the cursor and cursor2 
      $arr=$this->track_tag_cursors($search_text_array[$i]);
      
      //the index which you want to get the position of
      $tem=$search_array[$i];
      
      //to support count_tag_in_tree
      //when given a ? it returns the number of occurences of the current tag name
      if ($tem=="?")
       {
        return count($arr)-1;
       }
      else { 
      
      //to support the auto-last method
      //if the current tag index equals "-1" so replace it by the last occurence index
      if ($tem==-1) 
       {
        $tem=count($arr)-1;
       }
      
      //now just set cursor one to the occurence position in the XML file accrding to $tem 
      $this->cursor=$arr[(int)$tem];
      
      //and set cursor2 at the end of that tag
      $this->cursor2=strpos($this->xml,"</".$search_text_array[$i].">",$this->cursor)+strlen("</".$search_text_array[$i].">");
       }
     }
   } 
}
//the function that appends a tag to the XML tree
function create_tag($tname,$tindex,$ntname) 
 {
  //first get the intended father tag
  $this->get_work_space($tname,$tindex);
  
  //explode the given colonedtagname into an array
  $search_text_array=explode(":",$tname);
  
  //after setting the cursors using get_work_space
  //get a cope of the returned tag
  $workarea=substr($this->xml,$this->cursor,$this->cursor2-$this->cursor);
  
  //calculate the place where you will put the tag start and end
  $inde=$this->cursor+strpos($workarea,"</".$search_text_array[count($search_text_array)-1].">");
  
  //here, replace means insert because the length argument is set to 0
  $this->xml=substr_replace($this->xml,"<".$ntname."></".$ntname.">",$inde,0);
 }
//the function that sets the value of an attribute 
function set_attribute($tname,$tindex,$attr,$value)
 {
  //first set the cursors using get_work_space
  $this->get_work_space($tname,$tindex);
  
  //now get a copy of the XML tag between cursor and cursor2
  $currxml=substr($this->xml,$this->cursor,$this->cursor2-$this->cursor);
  
  //cut the area of the tag on which you want to work
  //starting from the tag "<" and ending with the opening tag ">"
  $work=substr($currxml,0,strpos($currxml,">")+1);
  
  //if the attribute is already available
  if (strpos($work," ".$attr."=""))
  {
   //calculate the current value's length
   $currval_length=strlen($this->get_attribute_internal($currxml,$attr));
   
   //get the position of the attribute inside the tag
   $my_attribute_pos=strpos($work," ".$attr."="")+1;
   
   //get the length of the attribute
   $my_attribute_length=strlen($attr);
   
   //now replace the old value
   $this->xml=substr_replace($this->xml,$value,$this->cursor+$my_attribute_pos+$my_attribute_length+2,$currval_length);
   return TRUE;
  }
  
  //if the attribute wasn't already available'
  else
  {
   //check if there are other attributes in the tag
   if (strpos($work," "))
    {
     $separ=" ";
    }
   else
    {
     $separ=">";
    }
   
   //prepare the attribute
   $newattr=" ".$attr."="".$value.""";
   
   //insert the new attribute
   $this->xml=substr_replace($this->xml,$newattr,$this->cursor+strpos($work,$separ),0);
   return TRUE;
  } 
}
//the function that changes or adds the text of a tag
function set_tag_text($tname,$tindex,$text)
 {
  //firs get set the cursors using get_work_space
  $this->get_work_space($tname,$tindex);
  
  //explode the given colonedtagname in an array
  $search_text_array=explode(":",$tname);
  
  //get the latest name
  $currtname=$search_text_array[count($search_text_array)-1];
  
  //calculate the start of replacement
  $replace_start_index=strpos($this->xml,">",$this->cursor)+1;
  
  //calculate the end of replacement
  $replace_end_index=strpos($this->xml,"</".$currtname.">",$this->cursor)-1;
  
  //calculate the length between them
  $tem=$replace_end_index-$replace_start_index+1;
  
  //and now replace
  $this->xml=substr_replace($this->xml,$text,$replace_start_index,$tem);
 }
//functio that removes a tag 
function remove_tag($tname,$tindex) 
 {
  //set the cursors using get_work_space
  $this->get_work_space($tname,$tindex);
  
  //now replace with ""
  $this->xml=substr_replace($this->xml,"",$this->cursor,$this->cursor2-$this->cursor);
 }

}
?>                                                                                                                              testing.xml                                                                                         0100400 0177776 0177776 00000001125 07561460576 013104  0                                                                                                    ustar   nobody                          nogroup                                                                                                                                                                                                                <?xml version="1.0"?>
<tryingxml testattribute="we are here">
<firstlevel testingattribute="no we aren't here">
sometext for the first level
<secondlevel testingattribute="We are there">
some text for the second level
<thirdlevel testingattribute="we aren't there">
some text for the third level
</thirdlevel>
<thirdlevel testingattribute="we are every where :)">
this is a test of multiple children per parent node
<justachild testingattribute="a value ofcourse">is it okay with you now ? go check the script</justachild>
</thirdlevel>
</secondlevel>
</firstlevel>
</tryingxml>
                                                                                                                                                                                                                                                                                                                                                                                                                                           nav.php                                                                                             0100400 0177776 0177776 00000000543 07561460576 012205  0                                                                                                    ustar   nobody                          nogroup                                                                                                                                                                                                                <?php
//including khalid xml parser
include_once "kxparse.php";

//create the object
$xmlnav=new kxparse("nav.xml");

for ($i=1;$i<=$xmlnav->count_tag("nav:item","1:?");$i++)
{?>
<div class="navit"><a href="<?php echo $xmlnav->get_attribute("nav:item","1:".$i,"href") ?>"><?php echo $xmlnav->get_tag_text("nav:item","1:".$i) ?></a></div>
<?}?>
                                                                                                                                                             nav.xml                                                                                             0100400 0177776 0177776 00000000507 07561460576 012216  0                                                                                                    ustar   nobody                          nogroup                                                                                                                                                                                                                <?xml version="1.0"?>
<nav>
<item href="http://111cn.net/kxparse/index.php">Home</item>
<item href="http://111cn.net/kxparse/news.php">News</item>
<item href="http://111cn.net/kxparse/docs.php">Documentation</item>
<item href="http://111cn.net/kxparse/changelog.php">Change Log</item>
</nav>

php xml生成函数程序代码


function xml_file($filename, $keyid = 'errorentry')
{
   $string = implode('', file($filename));
   return xml_str($string, $keyid);
}

function xml_str($string, $keyid = 'errorentry')
{
 $parser = xml_parser_create();
 xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
 xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
 xml_parse_into_struct($parser, $string, $values, $tags);
 xml_parser_free($parser);
 $tdb = array();
 foreach ($tags as $key=>$val)
 {
  if($key != $keyid) continue;
  $molranges = $val;
  for ($i=0; $i < count($molranges); $i+=2)
  {
     $offset = $molranges[$i] + 1;
     $len = $molranges[$i + 1] - $offset;
     $tdb[] = xml_arr(array_slice($values, $offset, $len));
  }
 }
 return $tdb;
}

function xml_arr($mvalues)
{
 $arr = array();
 for($i=0; $i < count($mvalues); $i++)
 {
    $arr[$mvalues[$i]['tag']] = $mvalues[$i]['value'];
 }
 return $arr;
}

在很多应用中我们都会用到xml 特别是互动设计的朋友哦flash+xml等,下在我们就来一个实时的php输出xml 文件并进行分页吧。

<?php
    require_once("Inc/Conn.php");//系统配置文件
 $sql = "select *  from ose";
 $result = mysql_query($sql) ;
 $total = mysql_num_rows($result);
 if( $total )
 {
  $pagesize =4;
  $pagecount=($total % $pagesize)?(int)($total / $pagesize)+1:$total/$pagesize;//统计总页面
  $page  =isset($_GET['page'])?$_GET['page']:1;//取得当前页面
  $start =($page>=1 && $page<=$pagecount)?$start=$pagesize*($page-1):$start=1;//取得超始记录
  $sql.="  order by id desc limit $start,$pagesize" ;  
  $result = mysql_query( $sql );
  while( $rs = mysql_fetch_array($result) )
  {   
   $temp .= "<member id="".$rs['id']."" roomname="".$rs['User_Name'].""/>n";   
  }
 }
 else
 {
  die('{result:"false"}');
 }
 //die('bb');
 echo "<?xml version="1.0" encoding="gb2312" ?>n<root>n<page now="$page" count="$pagecount"/>n<roomlist>n",$temp,"</roomlist>n</root>";
 
?>

输出结果为:

这里是一款简单的考试问题系统哦,包括有ajax+php+xml实现的一款哦,下在我们先来看看test.html 文件吧。

<html>
<head>
<title>Ajax应用</title>
<script language="JavaScript" type="text/javascript" src="ajax.js"></script>
<style type="text/css">
<!--CSS样式表用于定义页面的显示外观,将内容和显示分离
#answershow{ border:#E2FAFA; color:#000099; font-size:12px;}
#main{visibility:hidden;}
#begin{
    visibility:visible;
 position:absolute;
 left:135px;
 top:103px;
 width:37px;
 height:16px;
 z-index:1;
}
-->
</style>
</head>
<body>
<div id="begin"><input type="button" id="startq" value="开始"></div>
<h1>简单测试系统</h1><p><b>问题:</b> <span id="question">欢迎使用本考试系统,请单击开始!</span></p>
<div id="main">
<p><b>答案:</b><input type="text" id="answer">
<input type="button" value="Submit" id="submit">
<br><b> 提示:</b><span id="answershow"></span>
</div>
<script language="JavaScript" type="text/javascript" src="manage.js"></script>
</body>
</html>

ajax.js文件

var ajaxreq=false, ajaxCallback;
function ajaxRequest(filename) {
   try {
    ajaxreq= new XMLHttpRequest();
   } catch (error) {
    try {
      ajaxreq = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (error) {
      return false;
    }
   }
   ajaxreq.open("GET",filename);
   ajaxreq.onreadystatechange = ajaxResponse;
   ajaxreq.send(null);
}
function ajaxResponse() {
   if (ajaxreq.readyState !=4) return;
   if (ajaxreq.status==200) {
      if (ajaxCallback) ajaxCallback();
   } else alert("Request failed: " + ajaxreq.statusText);
   return true;
}
是很简单的创建xmlhttp哦,更实用健全的xmlhttp创建方法最好的xmlhttp创建方法

mange.js 文件,

var qn=0,questions,right=0;
function getQuestions() {    //getElementById用于定位到要操作的页面元素
   document.getElementById("main").style.visibility="visible";
   document.getElementById("begin").style.visibility="hidden";
   document.getElementById("answer").focus();
   obj=document.getElementById("question");
   obj.firstChild.nodeValue="正在加载.....";
   ajaxCallback = nextQuestion;
   ajaxRequest("questions.xml");     //从服务器端XML文本加载问题
}
function nextQuestion() {        //显示下一个问题
   questions = ajaxreq.responseXML.getElementsByTagName("ask");
   obj=document.getElementById("question");
   if (qn < questions.length) {
      q = questions[qn].firstChild.nodeValue;
      obj.firstChild.nodeValue=q;
   } else {           //用户回答完使用题时,给予评分
   var anobj=document.getElementById("answershow");     
   anobj.innerHTML="您的分数为:"+right/questions.length*100;
   }
}
function checkAnswer() {       //即时检查用户作答情况
   answers = ajaxreq.responseXML.getElementsByTagName("key");
   a = answers[qn].firstChild.nodeValue;
   answerfield = document.getElementById("answer");
   if(answerfield.value==""){ var anobj=document.getElementById("answershow");//用户没有作答时提示
  var anobj=document.getElementById("answershow");
     anobj.innerHTML="对不起,你还没有回答";
  answerfield.focus();
     return;}
   else if (a.toLowerCase() == (answerfield.value).toLowerCase()) {  //用户答对时的提示
    right++;
    var anobj=document.getElementById("answershow");
     anobj.innerHTML="回答正确!";
   answerfield.focus();
   }
   else {
       var anobj=document.getElementById("answershow");  //用户打错时的提示
      anobj.innerHTML="答案错误,答案应为:"+a;
      answerfield.focus();
    }
   qn = qn + 1;
   answerfield.value="";
   nextQuestion();
}
//下面几行为按钮创建事件处理
obj=document.getElementById("startq");
obj.onclick=getQuestions;
ans=document.getElementById("submit");
ans.onclick=checkAnswer;
这个文件是分析节点,判断答案是否正确的。

questions.php

<?php
 $link=mysql_connect("localhost","root","");
 mysql_select_db("quiz",$link);
 mysql_query("set names gb2312");
 $sql=mysql_query("select * from questions");
 echo "<?xml version='1.0' encoding='gb2312'?><questions>";
 
 while($info=mysql_fetch_array($sql)){
  echo "<ask>".$info[question]."</ask><key>".$info[answer]."</key>";
  };
 echo "</questions>";
?>

questions.xml

<?xml version="1.0" encoding="gb2312" ?>
<questions>
  <ask>传统的web开发模式与Ajax开发模式相比,哪个效率更高?</ask>
  <key>Ajax</key>
  <ask>Ajax技术的核心对象是什么?</ask>
  <key>XMLHttpResponse</key>
  <ask>Ajax技术中使用什么方法来定位你需要操作的元素?</ask>
  <key>getElementById</key>
  <ask>Ajax用来定义显示的是什么技术?</ask>
  <key>CSS</key>
   <ask>服务端对浏览端的响应存储在XMLHttpResponse的哪个属性中(作为xml文档)?</ask>
  <key>responseXML</key>
</questions>

就这么简单哦,下面来看看这款吧。

[!--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
  • php文件上传你必须知道的几点

    本篇文章主要说明的是与php文件上传的相关配置的知识点。PHP文件上传功能配置主要涉及php.ini配置文件中的upload_tmp_dir、upload_max_filesize、post_max_size等选项,下面一一说明。打开php.ini配置文件找到File Upl...2015-10-21
  • ant design中upload组件上传大文件,显示进度条进度的实例

    这篇文章主要介绍了ant design中upload组件上传大文件,显示进度条进度的实例,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧...2020-10-29
  • C#使用StreamWriter写入文件的方法

    这篇文章主要介绍了C#使用StreamWriter写入文件的方法,涉及C#中StreamWriter类操作文件的相关技巧,需要的朋友可以参考下...2020-06-25
  • php实现文件下载实例分享

    举一个案例:复制代码 代码如下:<?phpclass Downfile { function downserver($file_name){$file_path = "./img/".$file_name;//转码,文件名转为gb2312解决中文乱码$file_name = iconv("utf-8","gb2312",$file_name...2014-06-07
  • C#路径,文件,目录及IO常见操作汇总

    这篇文章主要介绍了C#路径,文件,目录及IO常见操作,较为详细的分析并汇总了C#关于路径,文件,目录及IO常见操作,具有一定参考借鉴价值,需要的朋友可以参考下...2020-06-25
  • 查找php配置文件php.ini所在路径的二种方法

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

    本文给大家介绍的是nodejs实现使用阿里大鱼短信API发送消息的方法和代码,有需要的小伙伴可以参考下。...2016-01-20