我在wordpress网站上安装了插件WPdeposit,它允许用户存入他们的账户余额。当用户按下页面上的锚标签时,我试图操纵他们的平衡。
在plugins/models/user.php目录中有很多功能,我想我对这个感兴趣:
/**
* Update Regular balance to given amount (Will overwrite whatever value is in the db!)
*
* @param int $amount
* @return boolean
*/
public function updateRegularBalance($amount) {
if (floatval($amount)) {
return (bool) update_user_meta($this->_id, WPDEPOSIT_NAME.self::USER_AMOUNT, $amount);
} else {
throw new 'Exception(__('Amount is not a number', WPDEPOSIT_NAME));
}
}
当我尝试将此函数调用到主题的index.php上的页面时,如下所示:
updateRegularBalance(5);
但是我收到了这个错误。致命错误:调用未定义的函数updateRegularBalance()
有没有一种方法可以访问这个函数的使用,这样我就可以传递我想更新余额的值?
$class = new UserModel();
$class->updateRegularBalance(9999);
这从来不是我试图使用的函数,而是一种方法。