0

我有一个动态生成的 XML 文件,除了生成的 RSS 在

示例网址: http ://tinyurl.com/bbhnpg6

http://tinyurl.com/crbuny5 的实际工作 URL

如何正确转义 $URL 变量以便正确写入 &?有人可以显示此示例已正确更新吗?

// selecting data from "mytable"
// mytable = your article table name
$query = @mysql_query("SELECT * FROM TABLE1 ORDER BY EntryDate ASC LIMIT 0,5");
while($row = @mysql_fetch_array($query)){
// [title] = change it to your article title
$title = $row['MLNumber'];
$link = $row['ListingRid'];
$url = "http://www.domain.com/residential?frame=TAL&MLNO=";
$Unit= $row['Unit'];
$City= $row['City'];
$ZipCode= $row['ZipCode'];
$price = $row['SearchPrice'];
$description = $row['MarketingRemarks'];
$SubdivisionDisplay = $row['SubdivisionDisplay'];

echo '<item>';
echo '<title>' . $Unit . ' ' . $City . ', ' . $ZipCode . ' -' . $SubdivisionDisplay . '</title>';
echo '<link>' . $url . '' . $title . '</link>';
echo '<description><![CDATA[<p><strong>$' . $price . '.00</strong><BR> ' . $description . '<BR> ]]></description>';
//echo '<pubDate>' . date("D, d M Y H:i:s O", time()) . '</pubDate>';
echo '</item>';
}
echo '</channel>';
echo '</rss>';
?>
4

1 回答 1

1
$url = str_replace('&','&amp;', $url);
于 2012-11-18T23:01:47.480 回答