一、調(diào)用方式
$this->load->model('sns_model'); //引用時(shí)需要加載sns模型類,只加載一次即可
$this->sns_model->following($ta_uid, $my_uid);二、參數(shù)值
| 參數(shù) | 介紹 |
|---|---|
| $ta_uid | 關(guān)注Ta的uid |
$my_uid | 我的Uid |
三、返回值
0 關(guān)注失敗
1 關(guān)注成功
2 相互關(guān)注
-1 取消關(guān)注
四、開發(fā)示例
1、通過類方法的方式來關(guān)注
//
....
public function guanzhu($ta_uid, $my_uid) {
$this->load->model('sns_model');
$rt = $this->sns_model->following($ta_uid, $my_uid);
if ($rt == 1) {
return '關(guān)注成功';
} elseif ($rt == 2) {
return '相互關(guān)注';
} elseif ($rt == -1) {
return '取消關(guān)注';
} else {
return '關(guān)注失敗';
}
}
......2、通過url方式來關(guān)注
創(chuàng)建文件/member/controllers/guanzhu.php
class Guanzhu extends M_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
$ta_uid = $this->input->get('uid');
if (!$this->uid) {
$this->member_msg('您尚未登錄,無法關(guān)注對方');
}
$this->load->model('sns_model');
$rt = $this->sns_model->following($ta_uid, $this->uid);
if ($rt == 1) {
$this->member_msg('關(guān)注成功', '', 1);
} elseif ($rt == 2) {
$this->member_msg('相互關(guān)注', '', 1);
} elseif ($rt == -1) {
$this->member_msg('取消關(guān)注', '', 1);
} else {
$this->member_msg('關(guān)注失敗');
}
}
}關(guān)注鏈接為:{MEMBER_URL}index.php?c=guanzhu&uid={關(guān)注對象的uid}
文檔最后更新時(shí)間:2014-12-28 15:13:12