php读取xml文件
发布:smiling 来源: PHP粉丝网 添加日期:2014-08-21 10:04:09 浏览: 评论:
- <?php
- $path = 'http://xxx.xxx.xxx/example.xml';
- $str = file_get_contents($path);
- $str = <<<str
- ...
- <yw:cdtn text="Fair" code="34" temp="7" date="Thu, 10 Apr 2008 9:50 am BST" />
- ...
- <yw:f day="Thu" date="10 Apr 2008" low="1" high="11" text="Light Rain" code="11" />
- <yw:f day="Fri" date="11 Apr 2008" low="1" high="10" text="Light Rain" code="11" />
- ...
- str; //开源代码phpfensi.com
- preg_match('/<yw:cdtn.*text="(.*)"/iU', $str, $arr);
- echo $arr[1];
- preg_match_all('/<yw:f.*text="(.*)"/iU', $str, $arr);
- print_r($arr[1]);
- ?>
分享到: