php 封存远程图片到本地
程序员文章站
2022-05-02 22:22:19
...
php 保存远程图片到本地
显示远程图片:
?
??
第一种: 精确型
?
' : "false";?第二种:从文章中提取图片,并保存至本地
?
function getImg($str){ $str = stripslashes($str); $pattern = "/]*src\=\"(([^>]*)(jpg|gif|png|bmp|jpeg))\"/i"; //获取所有图片标签的全部信息 preg_match_all($pattern, $str, $matches); return $matches[1]; //$matches[1]中就是所想匹配的结果,结果为数组} $str = Two giant resource companies make up a big chunk of the Brazilian Bovespa. They are PetroBras (NYSE: PBR), with a market cap of $163.44 billion, and miner Vale (NYSE: VALE), which has a market cap of $178.95 billion. PBR shares have risen 1.47% thus far today and VALE is trading 0.77% higher at $34.03.This article was originally published on Benzinga, and is republished here with permission. EOT;foreach( getImg($str) as $url){ get_photo($url);}?
?
?
?
?
?
?
?
?
?
?
?
?
相关文章
相关视频