PHP 安装程序 - 检查环境要求
install/install.lock 文件后再安装!');
}
// 检查函数是否存在,存在则返回可用,不存在则返回不支持
function checkfunc($f,$m = false) {
if (function_exists($f)) {
return '可用';
} else {
if ($m == false) {
return '不支持';
} else {
return '不支持';
}
}
}
// 检查类是否存在,存在则返回可用,不存在则返回不支持
function checkclass($f,$m = false) {
if (class_exists($f)) {
return '可用';
} else {
if ($m == false) {
return '不支持';
} else {
return '不支持';
}
}
}
// 清空打包文件夹
function clearpack() {
// 获取../daishua_release_*目录下的所有文件
$array=glob('../daishua_release_*');
// 循环删除文件
foreach($array as $dir){
unlink($dir);
}
// 获取../daishua_update_*目录下的所有文件
$array=glob('../daishua_update_*');
// 循环删除文件
foreach($array as $dir){
unlink($dir);
}
}
// 生成指定长度的随机字符串
function random($length, $numeric = 0) {
// 将微秒时间和服务器根目录进行md5加密,得到一个种子
$seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
// 如果需要生成数字字符串,则将种子中的0去掉,同时加入012340567890
// 否则,在种子的末尾添加zZ和大写的种子
$seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed));
// 定义一个空字符串
$hash = '';
// 计算种子的长度-1,用于生成随机数
$max = strlen($seed) - 1;
// 循环生成指定长度的随机字符串
for($i = 0; $i < $length; $i++) {
// 将随机字符加入到hash字符串中
$hash .= $seed[mt_rand(0, $max)];
}
// 返回生成的随机字符串
return $hash;
}
?>
原文地址: https://www.cveoy.top/t/topic/mUOa 著作权归作者所有。请勿转载和采集!