yxy / y-util
常用工具类
1.0.0
2025-03-14 05:42 UTC
Requires
- php: ^8.2
- ext-ctype: *
- ext-iconv: *
- ext-openssl: *
- godruoyi/php-snowflake: 3.1.1.*
This package is not auto-updated.
Last update: 2025-04-11 05:57:26 UTC
README
/**
* 工具类
* @package Yxy\YUtil
* @method static string createUniqueCode(string $prefix = '', bool $replace = false) 雪花算法生成id
* @method static false|string|null isUrl(string|null $url) 是否是url
* @method static string makeCode(int $length = 6) 获取随机数字码
* @method static string randString(string $length = '32', int $type = 4) 获取随机字符串
* @method static string aesEncrypt(string $string, string $key = "ONSPEED") ssl加密
* @method static string aesDecrypt(string $string, string $key = "ONSPEED") ssl解密
* @method static array getTree(array $data, int $pid = 0, string $field1 = 'id', string $field2 = 'pid', string $field3 = 'children') 递归无限级分类权限
* @method static string toCamelCase(string $str) 下划线转驼峰命名
* @method static string toUnderScore(string $str) 驼峰命名转下划线
* @method static string millisecond() 获取毫秒数
* @method static bool isTimestamp(int|string $value) 是否是时间戳
* @method static string handleDatetime(int|string $time, string $format = 'Y-m-d H:i') 处理时间戳转时间
* @method static int|bool handleStrToTime(int|string $time) 处理时间转为时间戳
* @method static array getDayTime(string $time) 获取某天开始结束时间
* @method static array getWeeks(string $time = '', string $format = 'Y-m-d') 获取近七天的时间
* @method static array getMonths(string $time = '', bool $week = false) 获取给定时间月份信息
* @method static array periodDate(int|string $startTime, int|string $endTime) 获取期间内所有日期
* @method static array todayWeek($date = null, bool $cn = false) 获取今天周几
* @method static string weekToCn(int $week, string $prefix = '周') 周几转汉字
* @method static string getDomain() 获取域名
* @method static string getHttpPath(string $value) 获取查看地址
* @method static mixed deleteStr(string $str, string $delete_str) 删除字符串里所有指定字符
* @method static string getPublicPath(string $path = '') 获取根目录
* @method static array arraySplit(array $data, int $num = 10) 数组按数量拆分
* @method static bool isIndexArray(array $arr) 是否是索引数组
* @method static array arrayRemoveByKey(array $arr, string $key) 根据key删除数组中指定元素
* @method static array makeImage(string $path, string $file_name = '') 获取创建图片文件的路径
* @method static array makeFilePath(string $path = '',string $fileName = '',string $dir = 'y-images-y',string $suffix = 'png') 获取生成文件的路径
* @method static ?string getFirstCharters(mixed $str) 获取字符首字母
* @method static void handleCallable(callable $callback, array $resultArray = []) 执行回调函数
*/