Home > Backend Development > PHP Tutorial > php解析xml有关问题

php解析xml有关问题

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

php解析xml问题
我将获取到的数据写入xml文件,但是文件里面却有html标签,就会显示错误,如下图

这是xml文件

<br /><?xml version="1.0" encoding="utf-8"?><root><service_version>1.0</service_version><retcode>0</retcode><retmsg></retmsg><visa_id>157</visa_id><country_name>法国</country_name><country_code>FR</country_code><visa_type>旅游签证(广州领区)</visa_type><market_price>1350</market_price><member_price>1200</member_price><expiry_date>按申请</expiry_date><from>www.cuangs.com</from><retentionperiod>使馆批</retentionperiod><visa_week_day>5-10</visa_week_day><chau>欧洲</chau><visa_data><p><br />	<b><span   style="max-width:90%"><br /><br /></span></b> <br /></p><br /><p><br />	<b><span style="background-color:#FFE500;">如果使用特政策,需要在下订单后30分钟内支付,超过30分钟订单自动失效!</span></b> <br /></p><br /></visa_data><immigration_no>多次</immigration_no><consular_district>广州领区</consular_district><interview>抽查面试</interview><VisaAustralia></VisaAustralia></root><br />
Copy after login

请问这样的xml文件如何才能解析成数组,解析的时候visa_data的内容应该是对应的里面的所有内容,不能将里面的html标签也一并归入数组当中去。
------解决方案--------------------
本帖最后由 xuzuning 于 2014-07-03 11:13:25 编辑

$xml = simplexml_load_file($fn);<br />print_r($xml);
Copy after login

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