2012-06-12 8 views
0

를 사용하여 PHP의 소스로 pdf 파일 모든 앵커 태그를 찾는

+1

가 http://stackoverflow.com/questions/3577641/how-to-parse-and-process-html-with-php보기 – Qtax

답변

1

당신은 정규식 대신 DOMDocument를 사용해야합니다

$string='hello this is a dummy text <a href="../../abc.pdf">'; 
$doc = new DOMDocument; 
$doc->loadHTML($string); 

$href = $doc->getElementsByTagName('a')->item(0)->getAttribute('href'); 
echo basename($href); // abc.pdf