feat(common): add support for absolute URLs in __url function

- Implement a check for absolute URLs using filter_var with FILTER_VALIDATE_URL
- If the provided URL is an absolute URL, it is returned as is
- This enhancement allows the __url function to handle both relative and absolute URLs
This commit is contained in:
wolfcode
2024-12-16 13:51:27 +08:00
parent add8c5144c
commit c6cc9d4164

View File

@@ -19,6 +19,7 @@ if (!function_exists('__url')) {
*/
function __url(string $url = '', array $vars = [], bool $suffix = true, bool $domain = false): string
{
if (filter_var($url, FILTER_VALIDATE_URL)) return $url;
return url($url, $vars, $suffix, $domain)->build();
}
}