Home >Backend Development >PHP Tutorial >读取xml数据之后smarty的模板应该如何写

读取xml数据之后smarty的模板应该如何写

WBOY
WBOYOriginal
2016-06-13 11:44:51893browse

读取xml数据之后smarty的模板应该怎么写

header("Content-type:text/html; Charset=utf-8");<br />	$url = "http://www.hnta.cn/APIs/API_Get_NewsList.Asp?m=1&cid=J162HHC8824H&page=1&pagesize=2";<br />	$xml=simplexml_load_file($url); //将XML中的数据,读取到数组对象中 <br />	foreach($xml as $tmp){ <br />		//echo $tmp->title."-".$tmp->url."<br>"; <br />	}<br />	$qf->assign('xml',$xml);


<br />{foreach from=$xml item=list}<br />            {$list.title} | <br />        {/foreach}<br />


php代码没有问题,echo的话输出一切正常。
但是模板只输出了两个“|”符号,没有把数据给输出出来。

Statement:
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