想拿其中一部分数据也不一定非用XML,
explode + 正则函数基本就可以了
explode + 正则函数基本就可以了
解决方案 »
- 请问$_SERVER['HTTP_USER_AGENT']能否发现百度蜘蛛?
- 请问概念上都能理解,具体操作上就不会了,怎么办呢
- 100分奉上:帮忙看看这个网页如何采集?好像有cookie验证
- php xml乱码问题
- 感谢csdn,学习了很久,终于写出了第一个函数(散分)
- 请问php有做成像grid样式的方法吗?
- 请问php ftp命令怎么从一个aaa目录里的aaa.wma移动到bbb目录里?
- 问题请教-网页中可不可以直接显示幻灯片格式的文件(.ppt)象图片那样显示????
- php的一个日期问题?请大家帮忙。
- 谁 知道 http 头部 规范
- 可以把php程序和mysql放置在两个虚拟空间中么
- 文件下载问题---100分咯。。
在网页中,有以下代码,那请问如何拿呢?
<table>
<tr >
<td height=20 class=9p><span class=9pbig style1>自行车</span></td> <td bgcolor=FFFB9C class=red>39</td> <td bgcolor=FFFB9C class=red>25</td> <td bgcolor=FFFB9C class=red>33</td> <td bgcolor=FFFB9C class=red>97</td>
</tr>
〈tr>
<td>汽车</td>
<td>1</td>
<td>2</td>
</tr>
</table>
要取出每种物品的数字,要如何搞?
<?php
$html =<<< HTML
<table>
<tr >
<td height=20 class=9p><span class=9pbig style1>自行车</span></td> <td bgcolor=FFFB9C class=red>39</td> <td bgcolor=FFFB9C class=red>25</td> <td bgcolor=FFFB9C class=red>33</td> <td bgcolor=FFFB9C class=red>97</td>
</tr>
<tr>
<td>汽车</td>
<td>1</td>
<td>2</td>
</tr>
</table>
HTML;$str = str_replace(array("\r\n","</td>","</tr>"),array("",",","\n"),$html);
echo $str = strip_tags($str);
?>
当然转换成xml也是可以的,但要复杂很多!
php4需加载domxml扩展,且处理的文本必须是标准的xml格式
php5的情况要好一些,但是php5毕竟才推出。
没有什么情况好坏的分别,完全是看php开发者的再包装。
<table>
<tr><td>xxx</td></tr>
<tr><td>a</td></tr>
...
</table>
如果我想去掉 <tr><td>xxx</td></tr>这行,而其他数据和表得结构保持不变,那么要如何做呢?
<tr><td>xxx</td></tr>
<tr><td>a</td></tr>
...
</table>";str_replace("<tr><td>xxx</td></tr>","",$str);