我目前通過holidays.xml
到logged_in.php
表中。使一個值鏈接另一個
holidays.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<item>
<title>Luxurious Jamaican holidays | 40% Discount On Accommodation - Book Now!</title>
<link>http://www.numyspace.co.uk/~cgel1/holidays/Jamaica.html</link>
<description>7 nights at The Golden Palm, Montego Bay travelling from Newcastle with Fly Jamaica</description>
<pubDate>Sun, 13 Feb 2011 11:58:17 GMT</pubDate>
<guid>http://www.numyspace.co.uk/~cgel1/holidays/Jamaica.html</guid>
</item>
</channel>
</rss>
logged_in.php
<?php
// load the xml file into a simplexml instance variable
$holiday = simplexml_load_file('holidays.xml');
// draw a table and column headers
echo "<table border=\"0\">";
/* echo " <th>Title</td>
<th>Link</td>
<th>Description</td>
<th>Published Date</th>";
*/
// iterate through the item nodes displaying the contents
foreach ($holiday->channel->item as $holiday) {
echo "<tr>";
echo "<td>{$holiday->title}</td>";
echo "<td>{$holiday->link}</td>";
echo "<td>{$holiday->description}</td>";
echo "<td>{$holiday->pubDate}</td>";
echo "</tr>\n";
}
echo "</table>";
?>
我想echo "<td>{$holiday->link}</td>";
是的echo "<td>{$holiday->title}</td>";
一個鏈接,這樣的鏈接將是href和冠軍稱號。有沒有簡單的方法來做到這一點?
我幾乎在那裏,這工作完美的感謝。 – 2012-03-09 10:08:12