Chrome、Opera、Mozilla 内容解码失败
我在 php 中有一个函数,它列出了 Twitter 中用户的关注者。当我使用 chrome 导航到包含该功能的页面时,它可以工作,有时却不能。
Chrome 工作 5 次中有 3 次后,出现“错误 330 (net::ERR_CONTENT_DECODING_FAILED):未知错误”
Mozilla 工作 5 次后出现 4 次,然后出现“内容编码错误”
Opera 显示此信息
警告:为 foreach() 提供的参数无效 C:\wamp\www\ntwyt\core\common\twitter.php 第 1639 行 �j&x���o�4�a �h��RA�N���T.&�Km�n� 5ý i�<Т K���/o4��b�@�Y�����
这是代码
function theme_followers($feed, $hide_pagination = false) {
$rows = array();
if (count($feed) == 0 || $feed == '[]') return '<p>No users to display.</p>';
foreach ($feed->users->user as $user) {
$name = theme('full_name', $user);
$tweets_per_day = twitter_tweets_per_day($user);
$last_tweet = strtotime($user->status->created_at);
$content = "{$name}<br /><span class='about'>";
if($user->description != "")
$content .= "Bio: " . twitter_parse_tags($user->description) . "<br />";
if($user->location != "")
$content .= "Location: {$user->location}<br />";
$content .= "Info: ";
$content .= pluralise('tweet', $user->statuses_count, true) . ", ";
$content .= pluralise('friend', $user->friends_count, true) . ", ";
$content .= pluralise('follower', $user->followers_count, true) . ", ";
$content .= "~" . pluralise('tweet', $tweets_per_day, true) . " per day<br />";
$content .= "Last tweet: ";
if($user->protected == 'true' && $last_tweet == 0)
$content .= "Private";
else if($last_tweet == 0)
$content .= "Never tweeted";
else
$content .= twitter_date('l jS F Y', $last_tweet);
$content .= "</span>";
$rows[] = array('data' => array(array('data' => theme('avatar', theme_get_avatar($user)), 'class' => 'avatar'),
array('data' => $content, 'class' => 'status shift')),
'class' => 'tweet');
}
$content = theme('table', array(), $rows, array('class' => 'followers'));
if (!$hide_pagination)
$content .= theme('list_pagination', $feed);
return $content;
}
有什么问题吗?它有效和无效。
I have a function in php, which lists followers of a user in twitter. When I use chrome to navigate to the page which holds the function, It works, sometimes it doesn't.
Chrome works 3 out of 5 times before it gives "Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error"
Mozilla works 4 out of 5 times before it gives "Content Encoding Error"
Opera shows this
Warning: Invalid argument supplied for foreach() in
C:\wamp\www\ntwyt\core\common\twitter.php on line 1639
�j&x���o��4�a ���h��RA�N����T.&�Km�n� 5ý i�<Т
K���/o4�¨�b�@�Y�����
Here's the code
function theme_followers($feed, $hide_pagination = false) {
$rows = array();
if (count($feed) == 0 || $feed == '[]') return '<p>No users to display.</p>';
foreach ($feed->users->user as $user) {
$name = theme('full_name', $user);
$tweets_per_day = twitter_tweets_per_day($user);
$last_tweet = strtotime($user->status->created_at);
$content = "{$name}<br /><span class='about'>";
if($user->description != "")
$content .= "Bio: " . twitter_parse_tags($user->description) . "<br />";
if($user->location != "")
$content .= "Location: {$user->location}<br />";
$content .= "Info: ";
$content .= pluralise('tweet', $user->statuses_count, true) . ", ";
$content .= pluralise('friend', $user->friends_count, true) . ", ";
$content .= pluralise('follower', $user->followers_count, true) . ", ";
$content .= "~" . pluralise('tweet', $tweets_per_day, true) . " per day<br />";
$content .= "Last tweet: ";
if($user->protected == 'true' && $last_tweet == 0)
$content .= "Private";
else if($last_tweet == 0)
$content .= "Never tweeted";
else
$content .= twitter_date('l jS F Y', $last_tweet);
$content .= "</span>";
$rows[] = array('data' => array(array('data' => theme('avatar', theme_get_avatar($user)), 'class' => 'avatar'),
array('data' => $content, 'class' => 'status shift')),
'class' => 'tweet');
}
$content = theme('table', array(), $rows, array('class' => 'followers'));
if (!$hide_pagination)
$content .= theme('list_pagination', $feed);
return $content;
}
Whats the problem? It works and doesn't work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想你想循环:
I think you want to loop: