applicationcontext.xml PHP operation xml code

WBOY
Release: 2016-07-29 08:43:02
Original
839 people have browsed it

复制代码 代码如下:


/*获取图片新闻列表*/
function getPicNews($number=5){
require_once 'include/content_class.php';
$C Content();
$sql='select contentid as id,title,pic,typeid from `cms_content` where pic<>"" order by input_time desc';
$rows=$Content->getRowsBySQL($sql,$number);
$dom=new DOMDocument('1.0','GBK');
$root=$dom->createElement('slider');
$dom->appendChild($root);
foreach($rows as $val){
$item=$dom->createElement('item');
$root->appendChild($item);
$title=$dom->createAttribute('title');
$title_text=$dom->createTextNode($val['title']);
$title->appendChild($title_text);
$item->appendChild($title);
$href=$dom->createAttribute('href');
$href_text=$dom->createTextNode('show.php?newsid='.$val['id'].'&classid='.$val['typeid']);
$href->appendChild($href_text);
$item->appendChild($href);
$imageurl=$dom->createAttribute('imageurl');
$imageurl_text=$dom->createTextNode($val['pic']);
$imageurl->appendChild($imageurl_text);
$item->appendChild($imageurl);
}
return $dom->saveXML();
}

以上就介绍了applicationcontext.xml PHP操作xml代码,包括了applicationcontext.xml方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template