雨哲在开发插件的时候喜欢直接调用系统本身有的函数来实现,不太喜欢重复定义相同功能的函数,这里收集一下常用的function_core.php文件中的函数。 1、验证邮箱地址有效性:isemail($email); 2、随机字符:random($length, $numeric = 0); 3、查找字符是否存在:strexists($string, $find); 4、调用用户头像:avatar($uid, $size = 'middle', $returnsrc = FALSE, $real = FALSE, $static = FALSE, $ucenterurl = ''); 5、调用语言包:lang($file, $langvar = null, $vars = array(), $default = null); 6、调用报错页面:system_error($message, $show = true, $save = true, $halt = true); 7、根据用户ID获取用户信息:getuserbyuid($uid, $fetch_archive = 0); 9、在预定义字符之前添加反斜杠的字符串(支持数组):daddslashes($string, $force = 1);【相关:unc_string_addslashes.asp】 10、加密解密:authcode($string, $operation = 'DECODE', $key = '', $expiry = 0); 11、获取文件:dfsockopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE', $allowcurl = TRUE, $position = 0, $files = array()); 12、把预定义的字符转换为 HTML 实体(支持数组):dhtmlspecialchars($string, $flags = null);【相关:func_string_htmlspecialchars.asp】 13、函数输出一条消息,并退出当前脚本:dexit($message = ''); 14、查找字符并返回(支持在数组中查找):dstrpos($string, $arr, $returnvalue = false); 15、引用模板:template($file, $templateid = 0, $tpldir = '', $gettplfile = 0, $primaltpl=''); 16、签名:dsign($str, $length = 16)、modauthkey($id); 17、载入缓存数据:loadcache($cachenames, $force = false); 18、UNIX 时间戳格式化日期:dgmdate($timestamp, $format = 'dt', $timeoffset = '9999', $uformat = ''); 19、日期转 UNIX 时间戳:dmktime($date); 20、计算字符长度:dstrlen($str); 21、截取长度:cutstr($string, $length, $dot = ' ...'); 22、删除反斜杠(支持数组):dstripslashes($string); 23、根据aid获取缩略图:getforumimg($aid, $nocache = 0, $w = 140, $h = 140, $type = ''); 24、错误提示:showmessage($message, $url_forward = '', $values = array(), $extraparam = array(), $custom = 0); 25、提交表单验证:submitcheck($var, $allowget = 0, $seccodecheck = 0, $secqaacheck = 0); 26、分页:multi($num, $perpage, $curpage, $mpurl, $maxpages = 0, $page = 10, $autogoto = FALSE, $simple = FALSE, $jsfunc = FALSE); 27、简单分页:simplepage($num, $perpage, $curpage, $mpurl); 28、生成目录:dmkdir($dir, $mode = 0777, $makeindex = TRUE); 29、来路地址:dreferer($default = ''); 30、编码转换:diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE); 31、格式化字节大小:sizecount($size); 32、发送提醒:notification_add($touid, $type, $note, $notevars = array(), $system = 0); 33、发送站内短信:sendpm($toid, $subject, $message, $fromid = '', $replypmid = 0, $isusername = 0, $type = 0); 34、统计指定表指定条件的结果数量:getcount($tablename, $condition); 35、intval字符(支持数组):dintval($int, $allowarray = false); 36、删除反斜杠并反序列化:dunserialize($data); 37、获取编码类型:currentlang(); |
GMT+8, 2024-5-20 12:04 , Processed in 0.056502 second(s), 10 queries , Xcache On.
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.