Discuz! 函数
Discuz! 内置函数、类库介绍
一杯美式:)
这个作者很懒,什么都没留下…
展开
-
Discuz开发之后台表单函数
后台表单函数showformheader()创建表单头showformfooter()创建表单尾showsubmit()创建表单提交按钮showsetting()创建表单输入框showtableheader()创建表格头showformfooter()创建表格尾showsubmenu()创建二级导航栏shownav()创建面包屑导航栏showtips()创建提示信息showformheader()创建表单头showformheader($action,$extra,$name,$method);参数原创 2021-02-13 10:19:54 · 618 阅读 · 2 评论 -
Discuz!开发之DB、CT类解析
DB类函数功能DB::table($tablename)获取正确带前缀的表名,转换数据库句柄DB::delete($tablename, 条件,条数限制)删除表中的数据DB::insert($tablename, 数据(数组),是否返回插入ID,是否是替换式,是否silent)插入数据操作DB::update($tablename, 数据(数组)条件)更新操作DB::fetch(查询后的资源)从结果集中取关联数组,注意如果结果中的两个或以上的列具有.原创 2021-02-13 09:50:34 · 335 阅读 · 0 评论 -
discuz 生成随机数random函数解析
函数定义:function_core.phpfunction random($length, $numeric = 0) { $seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35); $seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed)); i原创 2021-06-19 14:01:39 · 466 阅读 · 2 评论 -
discuz 获取用户资料getuserprofile函数解析
函数定义:function_core.php函数参数:field:资料段名称返回值:存在返回资料内容反正返回nullfunction getuserprofile($field) { global $_G; if(isset($_G['member'][$field])) { return $_G['member'][$field]; } static $tablefields = array( 'count' => array('extcredits1','extcredi原创 2021-06-19 13:59:11 · 688 阅读 · 0 评论 -
Discuz!开发之时间处理函数dgmdate()详解
使用过Discuz!的朋友都会知道Discuz!的时间可以显示成多少秒前、多少分钟前、几个小时前、几天前等等,而不是单纯的显示标准时间,这样的时间显示方式就更显得人性化了!那么Discuz!是如何处理这个个性化时间显示的呢,我们来看看Discuz!时间处理函数dgmdate()定义文件:\source\function\function_core.php相关代码:/** * 格式化时间 * @param $timestamp - 时间戳 * @param $format - dt=日期时间原创 2021-03-12 20:13:53 · 387 阅读 · 0 评论 -
Discuz dmkdir函数解析
函数定义:function_core.phpfunction dmkdir($dir, $mode = 0777, $makeindex = TRUE){ if(!is_dir($dir)) { dmkdir(dirname($dir), $mode, $makeindex); @mkdir($dir, $mode); if(!empty($makeindex)) { @touch($dir.'/index.html'); @chmod($dir.'/index.html', 0777原创 2021-03-05 19:05:11 · 140 阅读 · 0 评论 -
Discuz!开发之文件加载路径函数libfile()介绍
定义位置:source\function\function_core.php函数代码function libfile($libname, $folder = '') { $libpath = '/source/'.$folder; if(strstr($libname, '/')) { list($pre, $name) = explode('/', $libname); $path = "{$libpath}/{$pre}/{$pre}_{$name}"; } else { $pa原创 2021-03-05 18:39:37 · 224 阅读 · 0 评论 -
Discuz deleterow函数解析
用于删除表格中的某行, 定义在static/js/admincp.jsfunction deleterow(obj) { var table = obj.parentNode.parentNode.parentNode.parentNode.parentNode; var tr = obj.parentNode.parentNode.parentNode; table.deleteRow(tr.rowIndex);}可配合addrow函数, 结合实际需求二次开发...原创 2021-02-13 09:57:22 · 118 阅读 · 0 评论 -
Discuz addrow函数解析
用于在表格中插入新行, 可结合实际需求自行二开函数定义:static\js\common.js使用示范:<!DOCTYPE html><html><head> <title>discuz中addrow函数demo</title> <meta charset="utf-8"></head><body><script type="text/javascript">原创 2021-02-13 09:51:45 · 428 阅读 · 1 评论 -
Discuz! showDialog函数介绍
函数定义:static\js\common.jsvar showDialogST = null;function showDialog(msg, mode, t, func, cover, funccancel, leftmsg, confirmtxt, canceltxt, closetime, locationtime) { clearTimeout(showDialogST); cover = isUndefined(cover) ? (mode == 'info' ? 0 : 1) : .原创 2021-02-12 22:47:13 · 314 阅读 · 0 评论 -
Discuz showWindow函数解析
函数定义static/js/common.jsshowWindow(k, url, mode, cache, v);参数解析:key默认值含义可选值及解释k(必填)浮窗的 keyurl(必填)get 方式 url 表示浮窗请求的地址 post 方式 url 表示浮窗提交的表单 idmode‘get’弹窗请求类型get: ajaxget 方式请求 url post: ajaxpost 方式请求 urlcache1是否缓存弹窗内容1:.原创 2021-02-12 22:45:07 · 947 阅读 · 0 评论 -
Discuz!开发之HTML转Discuz代码(bbcode)函数html2bbcode()
定义文件:\source\function\function_editor.phpfunction html2bbcode($text) { $text = strip_tags($text, '<table><tr><td><b><strong><i><em><u><a><div><span><p><strike><blockquote&.原创 2021-02-12 21:58:50 · 1126 阅读 · 1 评论 -
Discuz!文件缓存函数writetocache()解析
文件:/source/function/function_cache.phpfunction writetocache($script, $cachedata, $prefix = 'cache_') { global $_G; $dir = DISCUZ_ROOT.'./data/sysdata/'; if(!is_dir($dir)) { dmkdir($dir, 0777); } if($fp = @fopen("$dir$prefix$script.php", 'wb').原创 2021-02-12 21:57:01 · 835 阅读 · 0 评论 -
Discuz积分操作updatemembercount()函数
/*** 添加积分* @param Integer $uids: 用户uid或者uid数组* @param String $dataarr: 积分操作数组* @param Boolean $checkgroup: 是否检查用户组 true or false* @param String $operation: 操作类型* @param Integer $relatedid:* @param String $ruletxt: 积分规则文本* @param String $customtitle原创 2021-02-12 21:55:14 · 601 阅读 · 0 评论 -
Discuz!发送邮件sendmail函数使用介绍
方法定义文件 \source\function\function_mail.phpsendmail($toemail, $subject, $message, $from = '');参数说明:$toemail:接收邮箱$subject:邮件标题$message:邮件内容$from:邮件发送者,一般留空,默认为discuz后台所配置;用法示范:require_once libfile('function/mail');$res = sendmail('xxx@qq.com','这是邮.原创 2021-02-12 21:53:46 · 912 阅读 · 1 评论 -
Discuz!发送系统通知方法notification_add解析
方法定义位置:source\function\function_core.php函数代码:function notification_add($touid, $type, $note, $notevars = array(), $system = 0) { return helper_notification::notification_add($touid, $type, $note, $notevars, $system);}参数说明:$touid:接收通知的uid,即发给谁;$ty.原创 2021-02-12 21:50:40 · 653 阅读 · 1 评论 -
Discuz!开发之私信、提醒信息发送函数sendpm()解析
函数定义于:\source\function\function_core.phpfunction sendpm($toid, $subject, $message, $fromid = '', $replypmid = 0, $isusername = 0, $type = 0) { return helper_pm::sendpm($toid, $subject, $message, $fromid, $replypmid, $isusername, $type);}调用了helper_pm.原创 2021-02-12 21:48:57 · 345 阅读 · 0 评论 -
Discuz!开发之网站后台消息提醒函数cpmsg()介绍
定义文件:\source\function\function_admincp.php函数定义:function cpmsg($message, $url = '', $type = '', $values = array(), $extra = '', $halt = TRUE, $cancelurl = '') { global $_G; $vars = explode(':', $message); $values['ADMINSCRIPT'] = ADMINSCRIPT; if(cou.原创 2021-02-12 21:47:28 · 330 阅读 · 1 评论 -
Discuz!开发之消息提示函数showmessage()分析及用法实例
相关文件:\source\function\function_core.php\source\function\function_message.phpfunction showmessage($message, $url_forward = '', $values = array(), $extraparam = array(), $custom = 0) { require_once libfile('function/message'); return dsh.原创 2021-02-12 21:45:19 · 837 阅读 · 1 评论 -
Discuz! 调用默认的时间文本框 showcalendar()函数用法
调入JS文件<script src="static/js/calendar.js" type="text/javascript"></script>input 框<input name="lastdate" type="text" id="lastdate" size="20" autocomplete="off" onclick="showcalendar(event, this, true)" />PHP接受写入到数据库$lastdate = strto原创 2021-02-11 17:08:16 · 454 阅读 · 0 评论