从Wordpress RSS提要获取每个帖子的标签

Given a Wordpress RSS feed, I would like to know how can I get all the tags for each post. As far as I can see, for each tag there's an entry like this <category><![CDATA[ ]]></category>. I'm using PHP's SimpleXmlElement.

Thank you.

You can use SimpleXMLElement::xpath to do this. So:

<?php
$x = new SimpleXMLElement($xml_for_one_item);
$result = $x->xpath('category');
foreach ($result as $cat) {
    // do something with the category string in $cat
}
?>

The only disadvantage here is you must pass the XML for only one item at a time. If you know which items you wish to use, change it to $x->channel->item[0]->xpath('.//category') for the first item, etc.