Extracts a function from the Gregarius. You can automatically convert a relative path in a Web page to an absolute path.
function Relative_to_absolute ($content, $feed _url) {
Preg_match (/(HTTP|HTTPS|FTP):///, $feed _url, $protocol);
$server _url = Preg_replace ("/(Http|https|ftp|news)://", "", $feed _url);
$server _url = preg_replace ("//.*/", "", $server _url);
if ($server _url = =) {
return $content;
}
if (isset ($protocol [0])) {
$new _content = preg_replace (/href= "//, href=". $protocol [0]. $server _url./, $content);
$new _content = preg_replace (/src= "//, src=". $protocol [0]. $server _url./, $new _content);
} else {
$new _content = $content;
}
return $new _content;
}
?>
http://www.bkjia.com/PHPjc/508231.html www.bkjia.com true http://www.bkjia.com/PHPjc/508231.html techarticle extracts a function from the Gregarius. You can automatically convert a relative path in a Web page to an absolute path. function Relative_to_absolute ($content, $feed _url) {Preg_match (/(http|https| ...