2011-11-10 83 views
3

我正在写一个解析邮件从pop3邮箱的应用程序。 我已经提取了邮件的附加文件,现在我想转换邮件文本中的链接。如何将cid链接转换为http链接?

这意味着 我有这样的:src="cid:[email protected]" ,我想是这样的:src="http://xxx/image001.png"

你能不能帮我蒙山正则表达式吗? preg_replace('/cid:/', 'http://xxx')现在如何删除'@'后的序列?

谢谢

回答

5

尝试用:

$input = 'src="cid:[email protected]"'; 
$output = preg_replace('/cid:(.*?)@[\w.]*/', 'http://xxx/$1', $input); 

// string(29) "src="http://xxx/image001.png"" 
+0

这是所有好的非常感谢你 –

相关问题