-1
다음 작업을 수행하려면 PHP와 정규 표현식으로 가능할 수 있습니다. 하이퍼 링크의 최상위 도메인이 배열의 주어진 tld 이름과 일치하는 경우 내용 내부의 모든 하이퍼 링크를 가져 와서 다시 작성하십시오.php 정규 표현식 및 바꾸기
지금 주어진 내용에있는 모든 하이퍼 링크를 다시 쓰는 정규 표현식을
preg_replace('/<a(.*)href="([^"]*)"(.*)>/','<a$1href="goto.php?url=$2"$3>', $content);
예를
$tld = array("http://www.example.com","http://www.test.com");
if <a href="www.example.com">example</a> than <a href="/goto.php?url= www.example.com"</a>;
대신 DOM 파서를 사용하십시오. – Brad
[그는 조랑말이 온다 ...] (http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454) 오 남자가 점점 –
복잡한 나는 내 믿음을 잃는다. – lgt