- update facade

v5.1
Chaim 4 years ago
parent 2c80114efa
commit 75be7c242c

@ -39,9 +39,6 @@
},
"extra": {
"think": {
"services": [
"DtApp\\ThinkLibrary"
],
"config": {
"dtapp": "src/config.php"
}

@ -0,0 +1,2 @@
git push gitee
git push github

@ -1,76 +0,0 @@
<?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
// +----------------------------------------------------------------------
// | 版权所有 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 think\App;
use think\Container;
/**
* 自定义服务基类
* Class Service
* @package DtApp\ThinkLibrary
*/
abstract class Service
{
/**
* 应用实例
* @var App
*/
protected $app;
/**
* Service constructor.
* @param App $app
*/
public function __construct(App $app)
{
$this->app = $app;
$this->initialize();
}
/**
* 初始化服务
* @return $this
*/
protected function initialize()
{
return $this;
}
/**
* 静态实例对象
* @param array $args
* @return static
*/
public static function instance(...$args)
{
return Container::getInstance()->make(static::class, $args);
}
}

@ -16,16 +16,17 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\Dates as helper;
use think\Facade;
/**
* 日期门面
* Class Date
* Class Dates
* @see \DtApp\ThinkLibrary\Date
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Date
* @mixin helper
*/
class Date extends Facade
class Dates extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
@ -34,6 +35,6 @@ class Date extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Date';
return helper::class;
}
}

@ -16,18 +16,19 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\Files as helper;
use think\Facade;
/**
* 文件门面
* Class Files
* @see \DtApp\ThinkLibrary\Files
* @see \DtApp\ThinkLibrary\helper\Files
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Files
* @mixin helper
*
* @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文件
* @method helper delete(string $name) bool 删除文件
* @method helper deletes(string $name) bool 删除文件夹
* @method helper folderZip(string $name, string $suffix_name = '.png', string $file_name = '*') bool 把文件夹里面的文件打包成zip文件
*/
class Files extends Facade
{
@ -38,6 +39,6 @@ class Files extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Files';
return helper::class;
}
}

@ -16,17 +16,18 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\Ints as helper;
use think\Facade;
/**
* 数字门面
* Class Ints
* @see \DtApp\ThinkLibrary\Ints
* @see \DtApp\ThinkLibrary\helper\Ints
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Ints
* @mixin helper
*
* @method \DtApp\ThinkLibrary\Ints isEvenNumbers(int $num) bool 判断一个数是不是偶数
* @method \DtApp\ThinkLibrary\Ints isOddNumbers(int $num) bool 判断一个数是不是奇数
* @method helper isEvenNumbers(int $num) bool 判断一个数是不是偶数
* @method helper isOddNumbers(int $num) bool 判断一个数是不是奇数
*/
class Ints extends Facade
{
@ -37,7 +38,7 @@ class Ints extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Ints';
return helper::class;
}
}

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

@ -12,22 +12,23 @@
// | 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 DtApp\ThinkLibrary\helper\Randoms as helper;
use think\facade;
/**
* 随机门面
* Class Random
* Class Randoms
* @see \DtApp\ThinkLibrary\Random
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Random
* @mixin helper
*
* @method \DtApp\ThinkLibrary\Random generate(int $length = 6, int $type = 1) false|string 生成随机
* @method helper generate(int $length = 6, int $type = 1) false|string 生成随机
*/
class Random extends Facade
class Randoms extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
@ -36,7 +37,7 @@ class Random extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Random';
return helper::class;
}
}

@ -16,22 +16,23 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\Strings as helper;
use think\facade;
/**
* 字符串门面
* Class Str
* Class Strings
* @see \DtApp\ThinkLibrary\Str
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Str
* @mixin helper
*
* @method \DtApp\ThinkLibrary\Str extractBefore(string $str, int $start_num, int $end_num) bool|false|string 截取字符串前面n个字符
* @method \DtApp\ThinkLibrary\Str extractRear(string $str, int $num) false|string 截取字符串最后n个字符
* @method \DtApp\ThinkLibrary\Str filter(string $str) string 过滤字符串
* @method \DtApp\ThinkLibrary\Str exitContain(string $str, $nee = 3, $del = ',') bool 判断字符串是否包含某个字符
* @method \DtApp\ThinkLibrary\Str len(string $str) int 统计字符串长度
* @method helper extractBefore(string $str, int $start_num, int $end_num) bool|false|string 截取字符串前面n个字符
* @method helper extractRear(string $str, int $num) false|string 截取字符串最后n个字符
* @method helper filter(string $str) string 过滤字符串
* @method helper exitContain(string $str, $nee = 3, $del = ',') bool 判断字符串是否包含某个字符
* @method helper len(string $str) int 统计字符串长度
*/
class Str extends Facade
class Strings extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
@ -40,6 +41,6 @@ class Str extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Str';
return helper::class;
}
}

@ -16,25 +16,26 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\Times as helper;
use think\Facade;
/**
* 时间门面
* Class Time
* @see \DtApp\ThinkLibrary\Time
* Class Times
* @see \DtApp\ThinkLibrary\helper\Times
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Time
* @mixin helper
*
* @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 判断当前的时分是否在指定的时间段内
* @method helper getData(string $format = "Y-m-d H:i:s") false|string 当前时间
* @method helper getTime() false|string 当前时间戳
* @method helper getUDate() false|string 当前时间戳
* @method helper getTimeDifference(string $end_time, string $start_time) false|string 计算两个时间差
* @method helper dateToTimestamp(string $date) false|string 将指定日期转换为时间戳
* @method helper dateRear(string $format = "Y-m-d H:i:s", int $mun = 10) false|string 获取某个时间之后的时间
* @method helper dateBefore(string $format = "Y-m-d H:i:s", int $mun = 10) false|string 获取某个时间之前的时间
* @method helper checkIsBetweenTime(string $start, string $end) bool 判断当前的时分是否在指定的时间段内
*/
class Time extends Facade
class Times extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
@ -43,6 +44,6 @@ class Time extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Time';
return helper::class;
}
}

@ -16,20 +16,21 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\UnIqIds as helper;
use think\Facade;
/**
* 唯一ID门面
* Class UnIqId
* Class UnIqIds
* @see \DtApp\ThinkLibrary\UnIqId
* @package think\facade
* @mixin \DtApp\ThinkLibrary\UnIqId
* @mixin helper
*
* @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 唯一数字编码
* @method helper random($size = 10, $type = 1, $prefix = '') static 获取随机字符串编码
* @method helper date($size = 16, $prefix = '') static 唯一日期编码
* @method helper number($size = 12, $prefix = '') static 唯一数字编码
*/
class UnIqId extends Facade
class UnIqIds extends Facade
{
/**
* 获取当前Facade对应类名或者已经绑定的容器对象标识
@ -38,6 +39,6 @@ class UnIqId extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\UnIqId';
return helper::class;
}
}

@ -16,6 +16,7 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\Urls as helper;
use think\Facade;
/**
@ -23,11 +24,11 @@ use think\Facade;
* Class Urls
* @see \DtApp\ThinkLibrary\Urls
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Urls
* @mixin helper
*
* @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参数
* @method helper lenCode(string $url) static 编码
* @method helper deCode(string $url) static 解码
* @method helper toParams(array $data) static 格式化参数格式化成url参数
*/
class Urls extends Facade
{
@ -38,6 +39,6 @@ class Urls extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Urls';
return helper::class;
}
}

@ -16,17 +16,18 @@
namespace DtApp\ThinkLibrary\facade;
use DtApp\ThinkLibrary\helper\Xmls as helper;
use think\Facade;
/**
* XML门面
* Class Xmls
* @see \DtApp\ThinkLibrary\Xmls
* @see \DtApp\ThinkLibrary\helper\Xmls
* @package think\facade
* @mixin \DtApp\ThinkLibrary\Xmls
* @mixin helper
*
* @method \DtApp\ThinkLibrary\Xmls toXml(array $values) string 数组转换为xml
* @method \DtApp\ThinkLibrary\Xmls toArray(string $xml) string 将XML转为array
* @method helper toXml(array $values) string 数组转换为xml
* @method helper toArray(string $xml) string 将XML转为array
*/
class Xmls extends Facade
{
@ -37,6 +38,6 @@ class Xmls extends Facade
*/
protected static function getFacadeClass()
{
return 'DtApp\ThinkLibrary\Xmls';
return helper::class;
}
}

@ -14,15 +14,15 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 日期管理类
* Class Date
* @mixin Date
* @package DtApp\ThinkLibrary
* Class Dates
* @mixin Dates
* @package DtApp\ThinkLibrary\helper
*/
class Date
class Dates
{
}

@ -14,7 +14,7 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
use DtApp\ThinkLibrary\exception\DtAppException;
use ZipArchive;
@ -23,7 +23,7 @@ use ZipArchive;
* 文件管理类
* Class Files
* @mixin Files
* @package DtApp\ThinkLibrary
* @package DtApp\ThinkLibrary\helper
*/
class Files
{

@ -14,13 +14,13 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 数字管理类
* Class Ints
* @mixin Ints
* @package DtApp\ThinkLibrary
* @package DtApp\ThinkLibrary\helper
*/
class Ints
{
@ -29,7 +29,7 @@ class Ints
* @param int $num
* @return bool
*/
public function isEvenNumbers(int $num)
public function isEvenNumbers($num)
{
if ($num % 2 == 0) return true;
return false;
@ -40,7 +40,7 @@ class Ints
* @param int $num
* @return bool
*/
public function isOddNumbers(int $num)
public function isOddNumbers($num)
{
if ($num % 2 == 0) return false;
return true;

@ -14,15 +14,15 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 验证管理类
* Class Preg
* @mixin Preg
* @package DtApp\ThinkLibrary
* Class Pregs
* @mixin Pregs
* @package DtApp\ThinkLibrary\helper
*/
class Preg
class Pregs
{
/**
* 验证手机号码

@ -14,15 +14,15 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 随机管理类
* Class Random
* @mixin Random
* @package DtApp\ThinkLibrary
* Class Randoms
* @mixin Randoms
* @package DtApp\ThinkLibrary\helper
*/
class Random
class Randoms
{
/**
* 生成随机

@ -14,15 +14,15 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 字符串管理类
* Class Str
* @mixin Str
* @package DtApp\ThinkLibrary
* Class Strings
* @mixin Strings
* @package DtApp\ThinkLibrary\helper
*/
class Str
class Strings
{
/**
* 截取字符串前面n个字符
@ -31,7 +31,7 @@ class Str
* @param int $end_num 多少个
* @return bool|false|string
*/
public function extractBefore(string $str, int $start_num, int $end_num)
public function extractBefore($str, $start_num, $end_num)
{
if (strlen($str) < $start_num + $end_num) return $str;
return substr($str, $start_num, $end_num);
@ -43,7 +43,7 @@ class Str
* @param int $num 多少个
* @return false|string
*/
public function extractRear(string $str, int $num)
public function extractRear($str, $num)
{
if (strlen($str) <= $num) return $str;
return substr($str, -$num);
@ -54,7 +54,7 @@ class Str
* @param string $str
* @return string
*/
public function filter(string $str)
public function filter($str)
{
$str = str_replace('`', '', $str);
$str = str_replace('·', '', $str);
@ -132,7 +132,7 @@ class Str
* @param string $del
* @return bool
*/
public function exitContain(string $str, $nee = 3, $del = ',')
public function exitContain($str, $nee = 3, $del = ',')
{
if (strpos($str, $del) !== false) {
$var = explode($del, $str);
@ -151,7 +151,7 @@ class Str
* @param string $str 字符串
* @return int
*/
public function len(string $str)
public function len($str)
{
return strlen($str);
}

@ -14,15 +14,15 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 时间管理类
* Class Time
* @mixin Time
* @package DtApp\ThinkLibrary
* Class Times
* @mixin Times
* @package DtApp\ThinkLibrary\helper
*/
class Time
class Times
{
/**
* 当前时间

@ -14,15 +14,15 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 唯一ID管理类
* Class UnIqId
* @mixin UnIqId
* @package DtApp\ThinkLibrary
* Class UnIqIds
* @mixin UnIqIds
* @package DtApp\ThinkLibrary\helper
*/
class UnIqId
class UnIqIds
{
/**

@ -14,13 +14,13 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
/**
* 网址管理类
* Class Urls
* @mixin Urls
* @package DtApp\ThinkLibrary
* @package DtApp\ThinkLibrary\helper
*/
class Urls
{
@ -29,7 +29,7 @@ class Urls
* @param string $url
* @return string
*/
public function lenCode(string $url)
public function lenCode($url)
{
if (empty($url)) return false;
return urlencode($url);
@ -40,7 +40,7 @@ class Urls
* @param string $url
* @return string
*/
public function deCode(string $url)
public function deCode($url)
{
if (empty($url)) return false;
return urldecode($url);
@ -51,7 +51,7 @@ class Urls
* @param array $data
* @return string
*/
public function toParams(array $data)
public function toParams($data)
{
$buff = "";
foreach ($data as $k => $v) if ($k != "sign" && $v !== "" && !is_array($v)) $buff .= $k . "=" . $v . "&";

@ -14,7 +14,7 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary;
namespace DtApp\ThinkLibrary\helper;
use DtApp\ThinkLibrary\exception\DtAppException;
@ -22,7 +22,7 @@ use DtApp\ThinkLibrary\exception\DtAppException;
* XML管理类
* Class Xmls
* @mixin Xmls
* @package DtApp\ThinkLibrary
* @package DtApp\ThinkLibrary\helper
*/
class Xmls
{
@ -32,7 +32,7 @@ class Xmls
* @return string
* @throws DtAppException
*/
public function toXml(array $values)
public function toXml($values)
{
if (!is_array($values) || count($values) <= 0) throw new DtAppException('数组数据异常!');
$xml = "<xml>";
@ -55,7 +55,7 @@ class Xmls
* @return mixed
* @throws DtAppException
*/
public function toArray(string $xml)
public function toArray($xml)
{
if (!$xml) throw new DtAppException('xml数据异常');
libxml_disable_entity_loader(true);

@ -1,32 +0,0 @@
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 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\service;
use DtApp\ThinkLibrary\Service;
/**
* 测试服务
* Class TestService
* @package DtApp\ThinkLibrary\service
*/
class TestService extends Service
{
public function index()
{
return 'service.test.index';
}
}

@ -14,10 +14,13 @@
// | Packagist 地址 https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
use DtApp\ThinkLibrary\facade\Preg;
use DtApp\ThinkLibrary\facade\Pregs;
use DtApp\ThinkLibrary\facade\Times;
use DtApp\ThinkLibrary\service\TestService;
require '../vendor/autoload.php';
var_dump(Preg::isIphone(13800138000));
//var_dump(Preg::isIphone(13800138000));
var_dump(TestService::instance()->index());
//var_dump(TestService::instance()->index());
var_dump(Times::getTime());

Loading…
Cancel
Save