迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
在这个文件里面可以获取当前已经登录用户的id嘛?
App/Notice/Models/Notice.php
这个文件。
如果能获取是怎么样写?
插件教程:https://www.xunruicms.com/doc/app-703.html
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, //自己增加代(这里对嘛?获取当前已经登录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,
$this->uid 这个就是获取当前登录的用户id号
<?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, //自己增加代(这里对嘛?获取当前已经登录id) 'touid' => $touid, 'type' => max(1, (int)$type), 'isnew' => 1, 'content' => $note, 'url' => (string)$url, 'mark' => (string)$mark, 'inputtime' => SYS_TIME, ]); } return ''; } }
$this->uid 获取不到呢?还有方法吗?