This commit is contained in:
2020-11-17 18:36:56 +08:00
parent e4523458ee
commit 92af5482c7
2 changed files with 6 additions and 4 deletions
+6 -3
View File
@@ -46,11 +46,14 @@ if (!function_exists('isUrl')) {
*/
function isUrl($url, $get_info = true)
{
$queryMatch = '/((http[s]?):\/\/)?(([\w-_]+\.)+\w+(:\d+)?)(\/.*)?/';
if (!preg_match($queryMatch, $url, $outPut)) {
try {
$queryMatch = '/((http[s]?):\/\/)?(([\w-_]+\.)+\w+(:\d+)?)(\/.*)?/';
if (!preg_match($queryMatch, $url, $outPut)) {
return false;
}
}catch (Throwable $exception){
return false;
}
$port = str_replace(':', '', $outPut[5]);
[$isHttps, $domain, $port, $path] = [$outPut[2] == 'https', $outPut[3], $port, $outPut[6] ?? ''];