1

请告诉我如何制作 OPML 解析器。我有代码,但它不适用于所有通用 OPML 文件:

if (file_exists('test.opml')) {
    $xml =simplexml_load_file('test.opml');
}

for($i=0;$i<=count($xml);$i++) {
    $array=array($xml->body->outline->outline[$i]);
    $key=(array_keys($array));
    foreach ($array as $key) {
        echo "<strong>".($key['xmlUrl'][0])."</strong><br/>";
    }
}
4

1 回答 1

0

您可以使用 PHP OPML 解析器类,例如:http ://www.mt-soft.com.ar/2007/12/21/opml-parser-php-class/

示例用法:

<?php
$url = 'http://example.com/foo.opml'; // URL of OPML file
$parser = new IAM_OPML_Parser();
echo $parser->displayOPMLContents($url);
?>
于 2010-03-23T17:43:13.847 回答