我有一个名为privacy的库,我创建了一个名为_user_block_by_team的私有函数
我想在同一个库上的另一个公共函数上调用此函数,如下面的代码,但是它给了我一个错误Fatal error: Call to undefined method Team::_user_block_by_team()
,我在做错了?该库在autoload.php文件中自动加载
class Privacy {
function __construct()
{
$this->ci =& get_instance();
}
function user_block_team($id_user) {
$this->ci->_user_block_by_team($id_user);
}
function _user_block_by_team($id_user) {
$this->ci->load->library('settings');
if ($this->ci->settings->check_user_blocked($id_user)) {
return false;
}
return true;
}
}
答案 0 :(得分:6)
您只需致电$this->_user_block_by_team($id_user)
。