我有文件名为data_out.xml其中包含此XML代码:显示一个没有标签的xml文档?
<?xml version="1.0" ?>
- <allproperty>
- <aproperty>
<postcode>ha15rs</postcode>
<price>250</price>
<imagefilename>home2.gif</imagefilename>
<visits>2</visits>
</aproperty>
- <aproperty>
<postcode>ha36gs</postcode>
<price>150</price>
<imagefilename>home3.gif</imagefilename>
<visits>1</visits>
</aproperty>
- <aproperty>
<postcode>ha27se</postcode>
<price>300</price>
<imagefilename>home4.gif</imagefilename>
<visits>4</visits>
</aproperty>
- <aproperty>
<postcode>ha4678</postcode>
<price>200</price>
<imagefilename>home5.gif</imagefilename>
<visits>5</visits>
</aproperty>
</allproperty>
我想要写一个PHP脚本,如果没有标记输出这个数据,我不是担心格式,只是输出,欢呼声谢谢 ps IM使用SimpleXML
编辑:
这是错的还是对的:
<?php
$fp = fopen('data_out.xml', 'r');
echo preg_replace('/<[^>]+>/', '', $fp);
?>
抱歉,我更新了问题,所以didint突出的代码,我的错:)) – getaway 2010-12-16 00:46:04
你怎么想它虽然?每个值之间有空格?新队? – Jonah 2010-12-16 00:46:10
不,我只是数据输出,而不是标签,我不在乎格式化!谢谢我dnt真的很喜欢@slaks回答 – getaway 2010-12-16 00:50:11