我用simplehtml dom解析一个网站以获取图片中的所有链接。
问题是链接就像“/pics/bla.jpg”。
我有像“http://xxx.xxx/blob/gulsch”这样的网站的完整路径。
现在我想从图像(链接根+ /pics/bla.jpg)完整的图像链接(没有CONCAT) ,如:http://xxx.xxx/pics/bla.jpg
这应该很多网站的工作
我试过用爆炸()
$root = explode("/", $link);
echo $root[2];
我从来没有得到它的工作。
请帮忙。
可能的重复[PHP的 - 预先给所有链接没有HTTP或HTTPS](http://stackoverflow.com/questions/3681049/php-prepend-a-url-to-all-links-with- no-http-or-https) – Gordon
只是想知道...为什么你不想做concat? –