WordPress的側邊欄上的所有twitter狀態更新都有bit.ly鏈接。當我點擊它們時,我得到了404頁面,因爲它不會去bit.ly/uniquenumber,它會嘗試去www.domain.com/blog/「http://bit.ly/uniquenumber/」,www.domain.com/blog是wordpress博客的主頁。bit.ly鏈接在WordPress的twitter狀態更新導致404
有沒有簡單的方法來阻止它添加www.domain.com/blog和引號並帶我們到實際的鏈接?
任何幫助,將不勝感激。下面是代碼:
/* These prefixes and suffixes will display before and after the entire block of tweets. */
$prefix = ""; // Prefix - some text you want displayed before all your tweets.
$suffix = ""; // Suffix - some text you want displayed after all your tweets.
$tweetprefix = ""; // Tweet Prefix - some text you want displayed before each tweet.
$tweetsuffix = "<br \><br \>"; // Tweet Suffix - some text you want displayed after each tweet.
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1" . $limit;
function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {
$feed = str_replace("<", "<", $feed);
$feed = str_replace(">", ">", $feed);
$clean = explode("<content type=\"html\">", $feed);
$amount = count($clean) - 1;
echo $prefix;
for ($i = 1; $i <= $amount; $i++) {
echo $tweetsuffix;
$cleaner = explode("</content>", $clean[$i]);
echo $tweetprefix;
echo $cleaner[0]; echo $suffix; echo $tweetsuffix; ?>
<img src="<?php echo get_bloginfo('template_directory');?>/images/side.png" alt="A line dividing the twitter updates and the open courses listing">
<?php
}
echo $suffix;
}
$twitterFeed = file_get_contents($feed);
parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);
您有關於如何修復它的提示? – strangeloops 2010-01-14 13:06:34
tweet狀態更新中的URL確實在鏈接開始處包含http:// – strangeloops 2010-01-14 13:43:24
引號標記可能不是* in *的網址,但在你的代碼中的某個地方導致你正在輸出它。 – 2010-01-14 13:52:52