Home > Backend Development > PHP Tutorial > php读取xml节点有关问题,新手

php读取xml节点有关问题,新手

WBOY
Release: 2016-06-13 12:03:06
Original
948 people have browsed it

php读取xml节点问题,新手求助

本帖最后由 zw28323 于 2014-07-14 16:29:33 编辑 我创建了一个XML,结构如图:

在php中可以通过foreach获取xml中name节点的值,但是传到使用了smarty的html页面中用foreach循环取不到值,求大家帮忙看看怎么写可以取到name的值,本人新手


     
    

        

         php读取xml节点有关问题,新手
        

        

{$item.name}


    



------解决方案--------------------
不行就
$part[$i] = (array)$tmp;

settype$tmp, 'array‘);
$part[$i] = $tmp;
------解决方案--------------------
你在php这边将name值都取到构成一个二维数组再传给smarty不就行了。
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