discuz 插件开发疑难点整理

发布时间:2025-04-16 20:03

使用批注功能标注疑难点 #生活技巧# #工作学习技巧# #知识笔记技巧#

1、C::t('#wechat#common_member_wechat')->fetch_by_openid('xxxxxxxxxxxxxxxxxxx');

这句话表示从 source/plugin/wechat/table/common_member_wechat 类中调用fetch_by_openid方法

2、设置or获取cookies

dsetcookie('reg_nickname', '唐风', 7100);

getcookie('reg_nickname');

还有一种加密的,我不知道在哪设置,如果正常get不到,还有一种方法:authcode(getcookie('reg_nickname'), 'DECODE', $_G['config']['security']['authkey']);

3.在使用手机注册了一个用户后,需要执行下面这段代码:

C::t('common_member_profile')->update($uid, array('mobile' => $phone));

以后就可以直接用手机号登陆了,具体方法为

loaducenter();

$info = uc_user_login($phone,$passwd);

4. 检查用户登陆,例如错误次数不能超过5次

include_once libfile('function/member');

if(!($loginperm = logincheck($_GET['username']))) {

showmessage('login_strike');

}

密码错误登陆失败记录错误次数

if($result['status'] <= 0) {

loginfailed($_GET['username']);

failedip();

showmessage('login_invalid', '', array('loginperm' => $loginperm - 1));

}

5. 自带日期选择框的使用

<script src="static/js/calendar.js"></script>

<input type="text" class="stime" name="time" value="" readonly="readonly" οnclick="showcalendar(event, this, 1)">

6.模板加载

include template('目录/模板名称'); // 普通模板加载

include template('插件标识符:模板名称'); // 加载插件模板

7.discuz API 头部写法

<?php

define('IN_API', true);

define('CURSCRIPT', 'api');

define('DISABLEXSSCHECK', true);

require_once '../../../source/class/class_core.php';

$discuz = C::app();

$discuz->init();


网址:discuz 插件开发疑难点整理 https://www.yuejiaxmz.com/news/view/870598

相关内容

discuz二次开发之后导航无法高亮 $mnid == $nav[navid]解决办法(转)
【Discuz】在linux中搭建 Discuz 论坛(LAMP=linux+Apache+mysql+PHP)
Discuz!的Memcache缓存实现
Portlet插件开发说明文档
vscode开发vue必备插件
Discuz 用户多次登录失败 要求填写验证码
自己的整理
【项目亮点】高效时间管理新工具:Obsidian任务日历插件
Discuz! X1.5家园系统 打造Qzone般的个人空间
jquery 日程管理插件

随便看看