第一次发帖时,通常只是潜伏在其他回答的问题中寻求帮助,所以非常感谢大家的帮助!
我只是有个简短的问题。我正在为论坛库安装一个插件,它给了我:
Fatal error: Unsupported operand types in /home/joelwmale/public_html/forums/library/LatestThread/Controller/Public.php on line 13
这里的代码是:
<?php
class LatestThread_Controller_Public extends XFCP_LatestThread_Controller_Public
{
public function actionIndex()
{
$response = parent::actionIndex();
if ($response instanceof XenForo_ControllerResponse_View)
{
$LatestThread = LatestThread_Model_TLatestThread::LatestThreadArray();
}
$response->params += array('LatestThread' => $LatestThread);
return $response;
}
}
?>
第13行当然是:
$response->params += array('LatestThread' => $LatestThread);
我没有编写这个代码,我唯一的希望是解决这个问题,这样我就可以使用我的论坛,否则我就不能使用这个插件:(
提前感谢!
那个$response->params
是什么?你只能求和数字。。。你不能向它添加数组。如果$response->params
是一个数组,并且你想向它添加另一个元素,你应该有:
$response->params[] = array('LatestThread' => $LatestThread);
但这只是猜测。您必须更熟悉该代码才能修复它。
//You can't sum arrays. Try
$response->params['LatestThread'] = $LatestThread;
// OR
$response->params[] = array('LatestThread' => $LatestThread);
// OR
$response->params = array('LatestThread' => $LatestThread);