如题~
阅读器地址:http://rss.weather.gov.hk/rss/currentweather_uc.xml
我要获取cdata里温度,紫外线,相对湿度等内容,该如何搞定~?
------解决方案--------------------
php code$str=file_get_contents('http://rss.weather.gov.hk/rss/currentweather_uc.xml');preg_match('/\[cdata\[\s*(.*)
/uis',$str,$match);print_r($match[1]);
------解决方案--------------------
互联网真是好东西啊!参考文档:搜索“用simplexml 如何读取 中的内容呢”
php code$url = 'http://rss.weather.gov.hk/rss/currentweather_uc.xml';$xml = simplexml_load_file($url, 'simplexmlelement', libxml_nocdata); print_r($xml->channel->item->description);
