preg_replace を使用して URL の前にスラッシュを取得する
$contentss = file_get_contents("http://www.ncbi.nlm.nih.gov/pubmed?LinkName=pubmed_pubmed&from_uid=18032633" );
preg_match('/<div class="rprt">(.*)<\/div>/',$contentss,$matches);
$patterns = '/pubmed/';
$replacements = 'http://ncbi.nlm.nih.gov/pubmed';
$string = '<a href="pubmed/"></a>';
$getreplacements = ( preg_replace($patterns, $replacements, $matches));
echo $getreplacements[0];
出力は、アンカー タグ href で/ http://ncbi.nlm.nih.gov/pubmedのように表示されます。http://ncbi.nlm.nih.gov/pubmedの前のスラッシュを削除したい。
これから助けてください。前もって感謝します。