相対パスは絶対パスに変換されます。
737 ワード
抽出 Gregariusの関数の一つです。ウェブページの相対パスを自動的に絶対パスに変換できます。 機能 relative_to_absolute($content) $feed_url { preg_match('/(http𞓜httpsftp):\/', $feed_url $プロトコール $server_url = preg_replace("/\/\/")は、 "", $feed_url $server_url = preg_replace(\//.*/) "", $server_url if ($server_url == '') { return $content; } if (isset($protocol[0]) { $new_content = preg_replace('/href='/', 'h ref='.protocol[0].server_url.'/' $content; $new_content = preg_replace('/src='/' 'src='.protocol[0].server_url.'/' $new_content; } else { $new_content = $content; } return $new_content; } ?>