Authored by 郝肖肖

url 判断是否包含http

... ... @@ -943,6 +943,10 @@ class Helpers
*/
public static function getUrlSafe($url)
{
return '//' . ltrim(strtr($url, array('http://' => '', 'https://' => '')), '//');
if (stripos($url, 'http://')) {
return '//' . ltrim(strtr($url, array('http://' => '', 'https://' => '')), '//');
}
return $url;
}
}
... ...
... ... @@ -1098,6 +1098,10 @@ class Helpers
*/
public static function getUrlSafe($url)
{
return '//' . ltrim(strtr($url, array('http://' => '', 'https://' => '')), '//');
if (stripos($url, 'http://')) {
return '//' . ltrim(strtr($url, array('http://' => '', 'https://' => '')), '//');
}
return $url;
}
}
... ...