本文整理汇总了PHP中Feed::loadAtom方法的典型用法代码示例。如果您正苦于以下问题:PHP Feed::loadAtom方法的具体用法?PHP Feed::loadAtom怎么用?PHP Feed::loadAtom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Feed
的用法示例。
在下文中一共展示了Feed::loadAtom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
header('Content-Type: text/html; charset=utf-8');
if (!ini_get('date.timezone')) {
date_default_timezone_set('Europe/Prague');
}
require_once 'feed.class.php';
$atom = Feed::loadAtom('http://phpfashion.com/feed/atom');
?>
<h1><?php
echo htmlSpecialChars($atom->title);
?>
</h1>
<?php
foreach ($atom->entry as $entry) {
?>
<h2><a href="<?php
echo htmlSpecialChars($entry->link['href']);
?>
"><?php
echo htmlSpecialChars($entry->title);
?>
</a>
<small><?php
echo date("j.n.Y H:i", (int) $entry->timestamp);
?>
</small></h2>
<?php
示例2: str_replace
$description = str_replace('<a href="', '<a href="https://earthbot.net/', $item->description);
$description = str_replace('<img src=', '<img src="https://earthbot.net/', $description);
$description = str_replace('https://earthbot.net/http', 'http', $description);
$description = str_replace('https://earthbot.net//', 'https://earthbot.net/', $description);
$description = str_replace('https://earthbot.net/"/files', 'https://earthbot.net/files', $description);
$description = str_replace('https://earthbot.net/"/thumbs', 'https://earthbot.net/thumbs', $description);
echo '<h4>';
echo $item->title;
echo '</h4>';
echo '<br>';
echo $description;
echo '<hr>';
}
echo '</div>';
$url = "https://github.com/aerth.atom";
$atom = Feed::loadAtom($url);
//include ('thatfunk/fakefeed.txt');
echo '<div class="large-6 small-6 columns" style="padding-left: 1px; padding-right: 1px;margin-right: 0px;margin-left: 0px;">';
//echo 'Link: ', $atom->link;
echo '<h2>aerth\'s Github Log</h2><p><a href="https://github.com/aerth">View on Github</a><hr>';
foreach ($atom->entry as $item) {
$description = str_replace('<a href="', '<a href="https://github.com/', $item->content);
$description = str_replace('https://github.com/http', 'http', $description);
$description = str_replace('https://github.com//', 'https://github.com/', $description);
echo '<h4>';
echo $item->title;
echo '</h4>';
echo '<br>';
echo $description;
echo '<hr>';
}