Php MYBB警告[2]count():参数必须是实现可数的数组或对象-行:906
您好,抱歉,如果您有疑问,但我不知道如何修复PHP7.24上的MyBB 1.8.15错误 警告[2]count():参数必须是实现可计数的数组或对象-行:906Php MYBB警告[2]count():参数必须是实现可数的数组或对象-行:906,php,mybb,Php,Mybb,您好,抱歉,如果您有疑问,但我不知道如何修复PHP7.24上的MyBB 1.8.15错误 警告[2]count():参数必须是实现可计数的数组或对象-行:906 // Build the threaded post display tree. $query = $db->query(" SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline FROM ".TABLE_
// Build the threaded post display tree.
$query = $db->query("
SELECT p.username, p.uid, p.pid, p.replyto, p.subject, p.dateline
FROM ".TABLE_PREFIX."posts p
WHERE p.tid='$tid'
$visible
ORDER BY p.dateline
");
while($post = $db->fetch_array($query))
{
if(!$postsdone[$post['pid']])
{
if($post['pid'] == $mybb->input['pid'] || ($isfirst && !$mybb->input['pid']))
{
$postcounter = count($postsdone);
$isfirst = 0;
}
$tree[$post['replyto']][$post['pid']] = $post;
$postsdone[$post['pid']] = 1;
}
}
$threadedbits = buildtree();
$posts = build_postbit($showpost);
eval("\$threadexbox = \"".$templates->get("showthread_threadedbox")."\";");
$plugins->run_hooks("showthread_threaded");
}
第906行给出错误的是
$postcounter=count($postsdone)代码>如果$postsdone未计算为“可计数”(在本例中,如果它不是数组),则会发生此错误。我将在执行count($postsdone)之前验证$postsdone是否为数组。例如:
if(is_array($postsdone)){
$postcounter = count($postsdone);
}
else{
// set $postcounter to whatever you want it be...
}