preg_replace与样式格式问题

时间:2013-02-08 03:00:47

标签: php

我将此文本存储在我的数据库中:

 <div style=\"font-family:arial black;font-size:20px;text-align:center;color:#3333ff;font-weight:700;\">testing editor</div>

现在尝试将其处理到我的网站编辑器时,我正在使用此功能:

function striplen($Text)
{
// strip slashes
$Text = stripslashes($Text);
// find the errors quote
$errors = array("#\r\n#", '#"#');
// find the correct self content
$corrected = array('\r\n', '');

return preg_replace($errors, $corrected, $Text);
}

这样就把文字写成:

<div style=font-family:arial black;font-size:20px;text-align:center;color:#3333ff;font-weight:700;>testing editor</div>

你可以看到样式标签中的双引号消失了吗?

有什么建议吗?

非常感谢,

0 个答案:

没有答案
相关问题