不问了~ 本帖最后由 zhaixiaohu 于 2011-12-19 15:33:21 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $str = '<img style="margin: 0.0px;width: 750.0px;float: none;height: 157.0px;" border="0" src="http://www.xxx.com/imgextra/i4/222/1.jpg" width="750" height="157">';echo htmlspecialchars(preg_replace_callback('/src="(.*)"/isU', 'test', $str));function test($matches){ return 'src="' . base64_encode($matches[1]) . '"';}/**输出结果:<img style="margin: 0.0px;width: 750.0px;float: none;height: 157.0px;" border="0" src="aHR0cDovL3d3dy54eHguY29tL2ltZ2V4dHJhL2k0LzIyMi8xLmpwZw==" width="750" height="157">*/ PHP和MYSQL数据库是怎么回事? php读取EXCEL出现乱码? mysql中时间字段datetime如何判断为空 php跨域访问,困扰一个星期了 请问如何用PHP播放硬盘目录上的一个RM文件? 在线付款要有哪些步骤? 招聘高级php开发工程师 如何从文本中找出一句话? 公司要与其他网站合作,要求开发接口,供合作方调用,返回的数据是json或xml格式的 求高手帮忙看看这几句php代码怎么转成html格式下可用的代码 js里调用smarty变量 在线修改图片
$str = '<img style="margin: 0.0px;width: 750.0px;float: none;height: 157.0px;" border="0" src="http://www.xxx.com/imgextra/i4/222/1.jpg" width="750" height="157">';
echo htmlspecialchars(preg_replace_callback('/src="(.*)"/isU', 'test', $str));function test($matches)
{
return 'src="' . base64_encode($matches[1]) . '"';
}
/**
输出结果:
<img style="margin: 0.0px;width: 750.0px;float: none;height: 157.0px;" border="0" src="aHR0cDovL3d3dy54eHguY29tL2ltZ2V4dHJhL2k0LzIyMi8xLmpwZw==" width="750" height="157">
*/