How to get fully-qualified URL from anchor href?

末鹿安然 提交于 2019-12-08 02:43:28

I think the easiest way is to use a library like this: http://www.electrictoolbox.com/php-resolve-relative-urls-absolute/

Examples from the link:

url_to_absolute('http://www.example.com/sitemap.html', 'aboutus.html');

resolves to http://www.example.com/aboutus.html

or

url_to_absolute('http://www.example.com/content/sitemap.html', '../images/somephoto.jpg');

resolves to http://www.example.com/images/somephoto.jpg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!