찾다
php教程PHP源码php最简单的生成xml文档实例教程

这款教程是非常简单的,我们来看这款生成xml文档实例,就是把数据库的内容读出来,然后再用fopen生成一个.xml文档的文件就OK了。

<script>ec(2);</script>

 
 mysql教程_connect('localhost','root','1******') or die('database server no exists!');
 mysql_select_db('wk') or die('database error!'); 
 mysql_query("SET NAMES 'gbk'");//set document charset encode

 
 function CreateXml(){
  $tag  =0;
  $head =' ';  
  $sql  ="Select * from wk_works order by id desc";
 
  $res  =mysql_query($sql) or die(mysql_error());
     while($rs =mysql_fetch_array($res) ){
      if($tag==0){
     $stp = "get_name($rs['m_id'])."" portrait="".$rs['w_head']."" blogname = "".$rs['blogname']."" url="user.php?id=".$rs['m_id']."" poll = "".$rs['w_support']."" >";
    }else{
 
     $stp.= "get_name($rs['m_id'])."" portrait="".$rs['w_head']."" blogname = "".$rs['blogname']."" url="user.php?id=".$rs['m_id']."" poll = "".$rs['w_support']."" >";   
    }
    $tag++;
     }
  $foot ='';
  $cont =fopen("xml/111cn.net.xml",'w');
  fwrite($cont,$head.$stp.$foot);
  fclose($cont);
 }
 
 function get_name($id){
  $sqle ="select id,m_uid from wk_member where id='$id'";
  $relt = mysql_query($sqle);
  $reus = mysql_fetch_array($relt);
  return $reus['m_uid'];
 }
?>

 

本站原创转载注明: www.111cn.net

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

VSCode Windows 64비트 다운로드

VSCode Windows 64비트 다운로드

Microsoft에서 출시한 강력한 무료 IDE 편집기

ZendStudio 13.5.1 맥

ZendStudio 13.5.1 맥

강력한 PHP 통합 개발 환경