【问题标题】:How to create blogger xml feed using php?如何使用 php 创建博客 xml 提要?
【发布时间】:2012-06-26 12:49:54
【问题描述】:

如何使用 php 创建博客 xml 提要?

<?xml version='1.0' encoding='UTF-8'?><ns0:feed xmlns:ns0="http://www.w3.org/2005/Atom"><ns0:generator>Blogger</ns0:generator><ns0:entry><ns0:category scheme="http://www.blogger.com/atom/ns#" term="$category" /><br/><ns0:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/blogger/2008/kind#post" /><ns0:id>$postid</ns0:id><ns0:content type="html">$content</ns0:content><ns0:published>$published</ns0:published><ns0:title type="html">$title</ns0:title></ns0:entry></ns0:feed>

【问题讨论】:

    标签: php xml


    【解决方案1】:

    如果我理解了您的问题,希望我的回复对您有所帮助

    $slideshow [] = array('item' => $new[$j], 'source' => $x,'zoom' => $y); 
    
       $doc = new DOMDocument();
       $doc->formatOutput = true;
    
      $r = $doc->createElement( "slideshow" );
      $doc->appendChild( $r );
    
      foreach( $slideshow as $item )
      {
      $b = $doc->createElement( "item" );
    
      $source = $doc->createElement( "source" );
      $source->appendChild(
      $doc->createTextNode( $item['source'] )
      );
      $b->appendChild( $source );
    
      $zoom = $doc->createElement( "zoom" );
      $zoom->appendChild(
      $doc->createTextNode( $item['zoom'] )
      );
      $b->appendChild( $zoom );
    
      $r->appendChild( $b );
    
      }
      echo $doc->saveXML();
      $doc->save("abc.xml")
    

    【讨论】:

      猜你喜欢
      • 2012-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-16
      • 1970-01-01
      • 2019-11-29
      相关资源
      最近更新 更多