我刚刚在模型中创建了这个函数来查看我在我的社交网络中关注的人......我如何在视图中调用它?
function isfollowing($following){
$user_id = $this->session->userdata('uid');
$this->db->select('*');
$this->db->from('membership');
$this->db->join('following', "membership.id = following.tofollow_id");
$this->db->where("tofollow_id","$following");
$this->db->where("user_id", "$user_id");
$q = $this->db->get();
if($q->num_rows() > 0) {
return "yes";
} else {
return "no";
}
}
现在在我的视图中,我如何称呼它,因为我已经创建了一个函数来获取当前登录用户的 id 并且等于 $r->id
我这里怎么称呼它??if 语句中的“==”后面是什么?
风景
<?php if ( $r->id == ): ?>