From fad304ad8bcdcbe149fdeb715a644bc1a0ec1f7b Mon Sep 17 00:00:00 2001 From: Chaim Date: Wed, 5 Aug 2020 16:36:41 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E9=93=BE=E6=8E=A5=E9=97=A8=E9=9D=A2?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96URL=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 +++ src/common.php | 2 +- src/facade/Urls.php | 1 + src/helper/Urls.php | 12 ++++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f8e961..a6b090a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## v6.0.103 / 2020-08-05 +- 链接门面增加获取URL文件格式 + ## v6.0.102 / 2020-08-05 - 数组门面增加数组删除空格 diff --git a/src/common.php b/src/common.php index 1dcc225..d253ce3 100644 --- a/src/common.php +++ b/src/common.php @@ -26,7 +26,7 @@ use think\db\exception\DbException; /** * 定义当前版本 */ -const VERSION = '6.0.102'; +const VERSION = '6.0.103'; if (!function_exists('get_ip_info')) { /** diff --git a/src/facade/Urls.php b/src/facade/Urls.php index 1ac8aac..0796567 100644 --- a/src/facade/Urls.php +++ b/src/facade/Urls.php @@ -36,6 +36,7 @@ use think\Facade; * @method static string toParams(array $data) 格式化参数格式化成url参数 * @method static bool isUrl(string $url) 判断是否为Url * @method static string deleteProtocol(string $url) 删除协议 + * @method static string retrieve(string $url) 获取URL文件格式 */ class Urls extends Facade { diff --git a/src/helper/Urls.php b/src/helper/Urls.php index f0570ac..8c69a1d 100644 --- a/src/helper/Urls.php +++ b/src/helper/Urls.php @@ -104,4 +104,16 @@ class Urls } return $url; } + + /** + * 获取URL文件格式 + * @param string $url + * @return mixed|string + */ + public function retrieve(string $url) + { + $path = parse_url($url); + $str = explode('.', $path['path']); + return $str[1]; + } }