- update facade

v5.1
Chaim 4 years ago
parent 3e06b7ff87
commit 3d4f60a7a7

@ -1,5 +0,0 @@
## v5.1.2 / 2020-04-13
- 测试
## v5.1.1 / 2020-04-13
- 测试

@ -21,6 +21,11 @@
"homepage": "https://www.dtapp.net",
"require": {
"php": ">=5.6.0",
"ext-gd": "*",
"ext-libxml": "*",
"ext-json": "*",
"ext-simplexml": "*",
"ext-zip": "*",
"topthink/framework": "5.1.*",
"liguangchun/ip": "^1.1"
},
@ -36,7 +41,10 @@
"think": {
"services": [
"DtApp\\ThinkLibrary"
]
],
"config": {
"dtapp": "src/config.php"
}
}
}
}

@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
/**
* 日期管理类
* Class Date
* @mixin Date
* @package DtApp\ThinkLibrary
*/
class Date
{
}

@ -0,0 +1,100 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
use DtApp\ThinkLibrary\exception\DtAppException;
use ZipArchive;
/**
* 文件管理类
* Class Files
* @mixin Files
* @package DtApp\ThinkLibrary
*/
class Files
{
/**
* 删除文件
* @param string $name 路径
* @return bool
* @throws DtAppException
*/
public function delete(string $name)
{
if (empty($name)) throw new DtAppException('请检查需要删除文件夹的名称');
if (file_exists($name)) if (unlink($name)) return true;
return false;
}
/**
* 删除文件夹
* @param string $name 路径
* @return bool
* @throws DtAppException
*/
public function deletes(string $name)
{
if (empty($name)) throw new DtAppException('请检查需要删除文件夹的名称');
//先删除目录下的文件:
$dh = opendir($name);
while ($file = readdir($dh)) {
if ($file != "." && $file != "..") {
$fullpath = $name . "/" . $file;
if (!is_dir($fullpath)) {
unlink($fullpath);
} else {
$this->deletes($fullpath);
}
}
}
closedir($dh);
//删除当前文件夹:
if (rmdir($name)) {
return true;
} else {
return false;
}
}
/**
* 把文件夹里面的文件打包成zip文件
* @param string $name 路径
* @param string $suffix_name 需要打包的后缀名,默认.png
* @param string $file_name 文件名,默认全部名
* @return bool
* @throws DtAppException
*/
public function folderZip(string $name, string $suffix_name = '.png', string $file_name = '*')
{
if (empty($name)) throw new DtAppException('请检查需要打包的路径名称');
try {
// 获取目录下所有某个结尾的文件列表
$list = glob($name . "{$file_name}.{$suffix_name}");
$fileList = $list;
$zip = new ZipArchive();
// 打开压缩包
$zip->open($name, ZipArchive::CREATE);
//向压缩包中添加文件
foreach ($fileList as $file) $zip->addFile($file, basename($file));
//关闭压缩包
$zip->close();
return true;
} catch (\Exception $e) {
return false;
}
}
}

@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
/**
* 数字管理类
* Class Ints
* @mixin Ints
* @package DtApp\ThinkLibrary
*/
class Ints
{
/**
* 判断一个数是不是偶数
* @param int $num
* @return bool
*/
public function isEvenNumbers(int $num)
{
if ($num % 2 == 0) return true;
return false;
}
/**
* 判断一个数是不是奇数
* @param int $num
* @return bool
*/
public function isOddNumbers(int $num)
{
if ($num % 2 == 0) return false;
return true;
}
}

@ -1,7 +1,7 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
@ -19,6 +19,7 @@ namespace DtApp\ThinkLibrary;
/**
* 验证管理类
* Class Preg
* @mixin Preg
* @package DtApp\ThinkLibrary
*/
class Preg

@ -1,5 +1,18 @@
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库https://gitee.com/zoujingli/ThinkLibrary
// | github 代码仓库https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------

@ -0,0 +1,127 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
/**
* 时间管理类
* Class Time
* @mixin Time
* @package DtApp\ThinkLibrary
*/
class Time
{
/**
* 当前时间
* @param string $format 格式
* @return false|string
*/
public function getData(string $format = "Y-m-d H:i:s")
{
date_default_timezone_set('Asia/Shanghai');
return date($format, time());
}
/**
* 当前时间戳
* @return false|string
*/
public function getTime()
{
date_default_timezone_set('Asia/Shanghai');
return time();
}
/**
* 毫秒时间
* @return false|string
*/
public function getUDate()
{
date_default_timezone_set('Asia/Shanghai');
$msec = 0;
list($msec, $sec) = explode(' ', microtime());
return (float)sprintf('%.0f', (floatval($msec) + floatval($sec)) * 1000);
}
/**
* 计算两个时间差
* @param string $end_time 结束时间
* @param string $start_time 开始时间
* @return false|int
*/
public function getTimeDifference(string $end_time, string $start_time)
{
date_default_timezone_set('Asia/Shanghai');
$end_time = strtotime($end_time);
$start_time = $start_time == '' ? strtotime(self::getData('Y-m-d H:i:s')) : strtotime($start_time);
return $end_time - $start_time;
}
/**
* 将指定日期转换为时间戳
* @param string $date
* @return false|int
*/
public function dateToTimestamp(string $date)
{
date_default_timezone_set('Asia/Shanghai');
return strtotime($date);
}
/**
* 获取某个时间之后的时间
* @param string $format 格式
* @param int $mun 多少分钟
* @return false|string
*/
public function dateRear(string $format = "Y-m-d H:i:s", int $mun = 10)
{
date_default_timezone_set('Asia/Shanghai');
return date($format, strtotime(self::getData()) + $mun);
}
/**
* 获取某个时间之前的时间
* @param string $format 格式
* @param int $mun 多少分钟
* @return false|string
*/
public function dateBefore(string $format = "Y-m-d H:i:s", int $mun = 10)
{
date_default_timezone_set('Asia/Shanghai');
return date($format, strtotime(self::getData()) - $mun);
}
/**
* 判断当前的时分是否在指定的时间段内
* @param string $start 开始时间
* @param string $end 结束时间
* @return bool true在范围内false:没在范围内
*/
public function checkIsBetweenTime(string $start, string $end)
{
date_default_timezone_set('Asia/Shanghai');
$date = date('H:i');
$curTime = strtotime($date);//当前时分
$assignTime1 = strtotime($start);//获得指定分钟时间戳00:00
$assignTime2 = strtotime($end);//获得指定分钟时间戳01:00
$result = false;
if ($curTime > $assignTime1 && $curTime < $assignTime2) $result = true;
return $result;
}
}

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
/**
* 唯一ID管理类
* Class UnIqId
* @mixin UnIqId
* @package DtApp\ThinkLibrary
*/
class UnIqId
{
/**
* 获取随机字符串编码
* @param integer $size 字符串长度
* @param integer $type 字符串类型(1纯数字,2纯字母,3数字字母)
* @param string $prefix 编码前缀
* @return string
*/
public function random($size = 10, $type = 1, $prefix = '')
{
$numbs = '0123456789';
$chars = 'abcdefghijklmnopqrstuvwxyz';
if (intval($type) === 1) $chars = $numbs;
if (intval($type) === 2) $chars = "{$chars}";
if (intval($type) === 3) $chars = "{$numbs}{$chars}";
$string = $prefix . $chars[rand(1, strlen($chars) - 1)];
if (isset($chars)) while (strlen($string) < $size) {
$string .= $chars[rand(0, strlen($chars) - 1)];
}
return $string;
}
/**
* 唯一日期编码
* @param integer $size
* @param string $prefix
* @return string
*/
public function date($size = 16, $prefix = '')
{
if ($size < 14) $size = 14;
$string = $prefix . date('Ymd') . (date('H') + date('i')) . date('s');
while (strlen($string) < $size) $string .= rand(0, 9);
return $string;
}
/**
* 唯一数字编码
* @param integer $size
* @param string $prefix
* @return string
*/
public function number($size = 12, $prefix = '')
{
$time = time() . '';
if ($size < 10) $size = 10;
$string = $prefix . ($time[0] + $time[1]) . substr($time, 2) . rand(0, 9);
while (strlen($string) < $size) $string .= rand(0, 9);
return $string;
}
}

@ -0,0 +1,61 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
/**
* 网址管理类
* Class Urls
* @mixin Urls
* @package DtApp\ThinkLibrary
*/
class Urls
{
/**
* 编码
* @param string $url
* @return string
*/
public function lenCode(string $url)
{
if (empty($url)) return false;
return urlencode($url);
}
/**
* 解码
* @param string $url
* @return string
*/
public function deCode(string $url)
{
if (empty($url)) return false;
return urldecode($url);
}
/**
* 格式化参数格式化成url参数
* @param array $data
* @return string
*/
public function toParams(array $data)
{
$buff = "";
foreach ($data as $k => $v) if ($k != "sign" && $v !== "" && !is_array($v)) $buff .= $k . "=" . $v . "&";
$buff = trim($buff, "&");
return $buff;
}
}

@ -0,0 +1,64 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
use DtApp\ThinkLibrary\exception\DtAppException;
/**
* XML管理类
* Class Xmls
* @mixin Xmls
* @package DtApp\ThinkLibrary
*/
class Xmls
{
/**
* 数组转换为xml
* @param array $values 数组
* @return string
* @throws DtAppException
*/
public function toXml(array $values)
{
if (!is_array($values) || count($values) <= 0) throw new DtAppException('数组数据异常!');
$xml = "<xml>";
foreach ($values as $key => $val) {
if (is_array($val)) {
$xml .= "<" . $key . ">" . toXml($val) . "</" . $key . ">";
} else if (is_numeric($val)) {
$xml .= "<" . $key . ">" . $val . "</" . $key . ">";
} else {
$xml .= "<" . $key . "><![CDATA[" . $val . "]]></" . $key . ">";
}
}
$xml .= "</xml>";
return $xml;
}
/**
* 将XML转为array
* @param string $xml
* @return mixed
* @throws DtAppException
*/
public function toArray(string $xml)
{
if (!$xml) throw new DtAppException('xml数据异常');
libxml_disable_entity_loader(true);
return json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
}
}

@ -1,7 +1,7 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------

@ -0,0 +1,17 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
return [];

@ -0,0 +1,32 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\exception;
use Exception;
/**
* 错误管理
* Class DtAppException
* @package DtApp\ThinkLibrary\exception
*/
class DtAppException extends Exception
{
public function errorMessage()
{
return $this->getMessage();
}
}

@ -0,0 +1,39 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\facade;
use think\Facade;
/**
* 日期门面
* Class Preg
* @see \DtApp\ThinkLibrary\Date
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Date
*/
class Date extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Date';
}
}

@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\facade;
use think\Facade;
/**
* 文件门面
* Class Preg
* @see \DtApp\ThinkLibrary\Files
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Files
*
* @method \DtApp\ThinkLibrary\Files delete(string $name) bool 删除文件
* @method \DtApp\ThinkLibrary\Files deletes(string $name) bool 删除文件夹
* @method \DtApp\ThinkLibrary\Files folderZip(string $name, string $suffix_name = '.png', string $file_name = '*') bool 把文件夹里面的文件打包成zip文件
*/
class Files extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Files';
}
}

@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\facade;
use think\Facade;
/**
* 数字门面
* Class Preg
* @see \DtApp\ThinkLibrary\Ints
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Ints
*
* @method \DtApp\ThinkLibrary\Ints isEvenNumbers(int $num) bool 判断一个数是不是偶数
* @method \DtApp\ThinkLibrary\Ints isOddNumbers(int $num) bool 判断一个数是不是奇数
*/
class Ints extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Ints';
}
}

@ -1,7 +1,7 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
@ -24,11 +24,28 @@ use think\facade;
* @see \DtApp\ThinkLibrary\Preg
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Preg
* @package DtApp\ThinkLibrary\facade
* @method bool isIphone($mobile) static 验证手机号码
*
* @method \DtApp\ThinkLibrary\Preg isIphone($mobile) bool 验证手机号码
* @method \DtApp\ThinkLibrary\Preg isIphoneAll($mobile) bool 严谨验证手机号码
* @method \DtApp\ThinkLibrary\Preg isTel($tel) bool 验证电话号码
* @method \DtApp\ThinkLibrary\Preg isIdCard($mobile) bool 验证身份证号15位或18位数字
* @method \DtApp\ThinkLibrary\Preg isDigit($digit) bool 验证是否是数字(这里小数点会认为是字符)
* @method \DtApp\ThinkLibrary\Preg isNum($num) bool 验证是否是数字(可带小数点的数字)
* @method \DtApp\ThinkLibrary\Preg isStr($str) bool 验证由数字、26个英文字母或者下划线组成的字符串
* @method \DtApp\ThinkLibrary\Preg isPassword($str) bool 验证用户密码(以字母开头长度在6-18之间只能包含字符、数字和下划线)
* @method \DtApp\ThinkLibrary\Preg isChinese($str) bool 验证汉字
* @method \DtApp\ThinkLibrary\Preg isEmail($email) bool 验证Email地址
* @method \DtApp\ThinkLibrary\Preg isLink($url) bool 验证网址URL
* @method \DtApp\ThinkLibrary\Preg isQq($qq) bool 腾讯QQ号
* @method \DtApp\ThinkLibrary\Preg isIp($ip) bool 验证IP地址
*/
class Preg extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Preg';

@ -0,0 +1,48 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\facade;
use think\Facade;
/**
* 时间门面
* Class Preg
* @see \DtApp\ThinkLibrary\Time
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Time
*
* @method \DtApp\ThinkLibrary\Time getData(string $format = "Y-m-d H:i:s") false|string 当前时间
* @method \DtApp\ThinkLibrary\Time getTime() false|string 当前时间戳
* @method \DtApp\ThinkLibrary\Time getUDate() false|string 当前时间戳
* @method \DtApp\ThinkLibrary\Time getTimeDifference(string $end_time, string $start_time) false|string 计算两个时间差
* @method \DtApp\ThinkLibrary\Time dateToTimestamp(string $date) false|string 将指定日期转换为时间戳
* @method \DtApp\ThinkLibrary\Time dateRear(string $format = "Y-m-d H:i:s", int $mun = 10) false|string 获取某个时间之后的时间
* @method \DtApp\ThinkLibrary\Time dateBefore(string $format = "Y-m-d H:i:s", int $mun = 10) false|string 获取某个时间之前的时间
* @method \DtApp\ThinkLibrary\Time checkIsBetweenTime(string $start,string $end) bool 判断当前的时分是否在指定的时间段内
*/
class Time extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Time';
}
}

@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\facade;
use think\Facade;
/**
* 唯一ID门面
* Class Preg
* @see \DtApp\ThinkLibrary\UnIqId
* @package think\facade
* @mixin \DtApp\ThinkLibrary\UnIqId
*
* @method \DtApp\ThinkLibrary\UnIqId random($size = 10, $type = 1, $prefix = '') static 获取随机字符串编码
* @method \DtApp\ThinkLibrary\UnIqId date($size = 16, $prefix = '') static 唯一日期编码
* @method \DtApp\ThinkLibrary\UnIqId number($size = 12, $prefix = '') static 唯一数字编码
*/
class UnIqId extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\UnIqId';
}
}

@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\facade;
use think\Facade;
/**
* 网址门面
* Class Preg
* @see \DtApp\ThinkLibrary\Urls
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Urls
*
* @method \DtApp\ThinkLibrary\Urls lenCode(string $url) static 编码
* @method \DtApp\ThinkLibrary\Urls deCode(string $url) static 解码
* @method \DtApp\ThinkLibrary\Urls toParams(array $data) static 格式化参数格式化成url参数
*/
class Urls extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Urls';
}
}

@ -0,0 +1,41 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 5.1 for ThinkPhP 5.1
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\facade;
use think\Facade;
/**
* XML门面
* Class Preg
* @see \DtApp\ThinkLibrary\Xmls
* @mixin \DtApp\ThinkLibrary\Xmls
* @package DtApp\ThinkLibrary\facade
* @method \DtApp\ThinkLibrary\Xmls toXml(array $values) string 数组转换为xml
* @method \DtApp\ThinkLibrary\Xmls toArray(string $xml) string 将XML转为array
*/
class Xmls extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
* @access protected
* @return string
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Xmls';
}
}
Loading…
Cancel
Save