Home  >  Article  >  Backend Development  >  怎么提取字符串中的图片地址并转换编码后放回原处

怎么提取字符串中的图片地址并转换编码后放回原处

WBOY
WBOYOriginal
2016-06-13 13:00:52998browse

如何提取字符串中的图片地址并转换编码后放回原处?

本帖最后由 dz215136304 于 2012-06-27 12:05:34 编辑 字符串:


 怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处  怎么提取字符串中的图片地址并转换编码后放回原处

 






能将里面的 所有图片地址全部提取出来,然后将图片地址通过已经写好的静态方法 encodeimg  转码后,再放回原处


static function encodeimg($str,$suffix='.jpg_310x310.jpg'){
$prvestr=rand(0,9);
$endstr=rand(0,9);
$str=substr($str,0,-4).$suffix;
$str=base64_encode($str);
$str=$prvestr.$str.$endstr; return $str;
}
------解决方案--------------------
回调函数 如果是类的方法的话,需要用数组形式传递
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn