失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > php相对路径转化成绝对路径

php相对路径转化成绝对路径

时间:2018-11-11 20:12:57

相关推荐

php相对路径转化成绝对路径

php教程|php手册

php,相对,路径,转,化成,绝对,提取,Gregarius,中一个,函数,。,可以,把,网页,相,对路,径自,动转

php教程-php手册提取 Gregarius中的一个函数。可以把网页中的相对路径自动转化成绝对路径。

<?

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;

}

?>

肌肤测试源码,安装ubuntu过程卡,tomcat如何运行文件,go爬虫股票,php开发教程免费外包,seo兼职在家怎么做seolzw

如果觉得《php相对路径转化成绝对路径》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。