迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發(fā)框架,基于MIT開源許可協(xié)議發(fā)布,免費(fèi)且不限制商業(yè)使用,是免費(fèi)開源的產(chǎn)品,以萬端互聯(lián)為設(shè)計理念,支持的微信公眾號、小程序、APP客戶端、移動端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
聯(lián)系官方銷售客服
1835022288
028-61286886
在這個文件里面可以獲取當(dāng)前已經(jīng)登錄用戶的id嘛?
App/Notice/Models/Notice.php
這個文件。
如果能獲取是怎么樣寫?
$this->uid
回復(fù)迅睿框架創(chuàng)始人
public function add_notice($uid, $type, $note, $url = '', $mark = '') { if (!$uid || !$note) { return ''; } $uids = is_array($uid) ? $uid : explode(',', $uid); foreach ($uids as $uid) { $this->db->table('member_notice')->insert([ 'uid' => $uid, //自己增加代(這里對嘛?獲取當(dāng)前已經(jīng)登錄id) 'touid' => $this->uid, 'type' => max(1, (int)$type), 'isnew' => 1, 'content' => $note, 'url' => (string)$url, 'mark' => (string)$mark, 'inputtime' => SYS_TIME, ]); } return ''; }
'touid' => $this->uid,
這段是自己加上去的。想獲取當(dāng)前定了的用戶id
$this->uid 這個就是獲取當(dāng)前登錄的用戶id號
回復(fù)迅??蚣軇?chuàng)始人 我使用這個代碼獲取不到,是哪里寫錯嘛?
回復(fù)迅??蚣軇?chuàng)始人 還有其他獲取方法嗎?
<?php namespace Phpcmf\Model\Notice; class Notice extends \Phpcmf\Model { /** * 添加一條通知 * * @param string $uid * @param string $note * @return null */ public function add_notice($uid, $type, $note, $url = '', $mark = '') { if (!$uid || !$note) { return ''; } $touid = $this->uid; $uids = is_array($uid) ? $uid : explode(',', $uid); foreach ($uids as $uid) { $this->db->table('member_notice')->insert([ 'uid' => $uid, //自己增加代(這里對嘛?獲取當(dāng)前已經(jīng)登錄id) 'touid' => $touid, 'type' => max(1, (int)$type), 'isnew' => 1, 'content' => $note, 'url' => (string)$url, 'mark' => (string)$mark, 'inputtime' => SYS_TIME, ]); } return ''; } }
$this->uid 獲取不到呢?還有方法嗎?
回復(fù)@小孟學(xué)編程 如果是獲取不到,還有通過其他方法嗎
回復(fù)@靠懸賞(設(shè)置懸賞)賺錢買SVIP 是不是我添加的位置不對呢?
$this->uid
回復(fù)迅睿框架創(chuàng)始人
回復(fù)迅睿框架創(chuàng)始人
這段是自己加上去的。想獲取當(dāng)前定了的用戶id
回復(fù)迅??蚣軇?chuàng)始人 我使用這個代碼獲取不到,是哪里寫錯嘛?
回復(fù)迅??蚣軇?chuàng)始人 還有其他獲取方法嗎?
回復(fù)@小孟學(xué)編程 如果是獲取不到,還有通過其他方法嗎
回復(fù)@靠懸賞(設(shè)置懸賞)賺錢買SVIP 是不是我添加的位置不對呢?