0

我面临一个问题。我收到以下错误“致命错误:在第 58 行的 /var/www/Joomla/administrator/components/com_vodes/models/config.php 中的非对象上调用成员函数 loadByOption()”。我正在使用 Joomla 3.3.3 。我已将其从 1.5 升级到 3.3.3

function save()
    {
        // initialize variables.
        $table          = JTable::getInstance('component');
        $params         = JRequest::getVar('params', array(), 'post', 'array');
        $row            = array();
        $row['option']  = 'com_vodes';
        $row['params']  = $params;

        // load the component data for com_ajaxregister
        if (!$table->loadByOption('com_vodes')) {
            $this->setError($table->getError());
            return false;
        }

        // bind the new values
        $table->bind($row);

        // check the row.
        if (!$table->check()) {
            $this->setError($table->getError());
            return false;
        }

        // store the row.
        if (!$table->store()) {
            $this->setError($table->getError());
            return false;
        }

        return true;
    }

Please help to sought it out.
4

1 回答 1

0
 $table          = JTable::getInstance('component');

您在 getInstance 函数中传递了错误的参数 getInstance 函数返回 null 这使得 $table 变量成为非对象,因为它没有值。在设置参数时使用您的组件名称。

于 2015-01-28T05:26:31.750 回答