Server : nginx/1.20.2 System : Linux VM-4-4-centos 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed May 18 16:02:34 UTC 2022 x86_64 User : www ( 1000) PHP Version : 5.6.40 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv Directory : /www/wwwroot/greatapp.cn/vendor/topthink/think-helper/ |
# thinkphp5 常用的一些扩展类库 > 更新完善中 > 以下类库都在`\\think\\helper`命名空间下 ## Str > 字符串操作 ``` // 检查字符串中是否包含某些字符串 Str::contains($haystack, $needles) // 检查字符串是否以某些字符串结尾 Str::endsWith($haystack, $needles) // 获取指定长度的随机字母数字组合的字符串 Str::random($length = 16) // 字符串转小写 Str::lower($value) // 字符串转大写 Str::upper($value) // 获取字符串的长度 Str::length($value) // 截取字符串 Str::substr($string, $start, $length = null) ``` ## Hash > 创建密码的哈希 ``` // 创建 Hash::make($value, $type = null, array $options = []) // 检查 Hash::check($value, $hashedValue, $type = null, array $options = []) ``` ## Time > 时间戳操作 ``` // 今日开始和结束的时间戳 Time::today(); // 昨日开始和结束的时间戳 Time::yesterday(); // 本周开始和结束的时间戳 Time::week(); // 上周开始和结束的时间戳 Time::lastWeek(); // 本月开始和结束的时间戳 Time::month(); // 上月开始和结束的时间戳 Time::lastMonth(); // 今年开始和结束的时间戳 Time::year(); // 去年开始和结束的时间戳 Time::lastYear(); // 获取7天前零点到现在的时间戳 Time::dayToNow(7) // 获取7天前零点到昨日结束的时间戳 Time::dayToNow(7, true) // 获取7天前的时间戳 Time::daysAgo(7) // 获取7天后的时间戳 Time::daysAfter(7) // 天数转换成秒数 Time::daysToSecond(5) // 周数转换成秒数 Time::weekToSecond(5) ```