不问了~ 本帖最后由 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">*/ http新手问下set-cookie和cookie之间的关系。 求高手帮忙写个正则表达式... 有趣的$this的问题~ 为什么我抓这个页面,抓不下来,浏览器打开是没问题的,wget成功,但curl失败? 求一个BMG转JPG等其他格式的方法 纯散分--感觉PHP版块人气越来越不好了 希望学习JSP的人士请加群13258102 一个正则表达的问题 下学期要学好多呀。大家有没有谁给个建议,怎么学,看什么,做什么? 请问这种格式的数据如何用PHP读出 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">
*/