추가 방법http://URL에 아직 프로토콜이 포함되지 않은 경우(예: URL)http://,https://또는ftp://)? 예제: addhttp(“google.com”); // http://google.com addhttp(“www.google.com”); // http://www.google.com addhttp(“google.com”); // http://google.com addhttp(“ftp://google.com”); // ftp://google.com addhttp(“https://google.com”); // https://google.com addhttp(“http://google.com”); // http://google.com addhttp(“rubbish”); // http://rubbish 질문에 대한 답변 @nickf 코드 수정 버전: function addhttp($url) { if (!preg_match(“~^(?:f ht)tps?://~i”, $url)) { $url = “http://” . $url; } return $url; } 인식하다ftp://,ftps://,http://그리고.https://무감각한 … Read more