firefox:自定义 WordPress 博客侧边栏中的 bit.ly 链接出现 404 错误

发布于 2024-08-18 02:23:03 字数 1831 浏览 2 评论 0 原文

我在博客的侧边栏上显示 Twitter 状态更新,该博客通常也有 bit.ly 或 ow.ly 链接。但每次我在 Firefox 浏览器中单击它时,都会出现 404 错误,因为它尝试访问以下网址:www.domain.com/blog/"http://bit.ly/uniquenumber”而不是 bit.ly/uniquenumber。

我刚刚检查了它,它似乎可以在 mac 上的 google chrome 上运行,但不能在 mac os x 上的 firefox 上运行。还有其他人有类似的问题吗?

下面是接收twitter状态更新的代码:

/* 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("&lt;", "<", $feed);  
    $feed = str_replace("&gt;", ">", $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); 

I have twitter status updates showing on the sidebar of the blog which often has the bit.ly or ow.ly links as well. But everytime I click on it in the firefox browser it gives me a 404 error because it tries for the following url: www.domain.com/blog/"http://bit.ly/uniquenumber" instead of bit.ly/uniquenumber.

I just checked it and it seems to work on google chrome on mac but not on firefox on mac os x. Does anybody else have similar problems.

Below is the code of receiving the twitter status updates:

/* 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); 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

-残月青衣踏尘吟 2024-08-25 02:23:03

为你想出来了。改变这个:

$feed = str_replace("<", "<", $feed);  
$feed = str_replace(">", ">", $feed);  

到这个

$feed = str_replace("<", "<", $feed);  
$feed = str_replace(">", ">", $feed);  
$feed = str_replace(""", '"', $feed);  

Figured it out for you. Change this:

$feed = str_replace("<", "<", $feed);  
$feed = str_replace(">", ">", $feed);  

to this

$feed = str_replace("<", "<", $feed);  
$feed = str_replace(">", ">", $feed);  
$feed = str_replace(""", '"', $feed);  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文