|
发表于 2016-8-19 10:03:34
|
显示全部楼层
我这样替换正常~~
PHP复制代码 /** 锁定标签 */ $string = preg_replace_callback("/<(" . self::LOCKED_HTML_TAG . ")[^>]*>.*?<\/\\1>/is", array('Common', '__lock_html'), $string);
$string = preg_replace_callback("/\s*<(" . self::ELEMENT_HTML_TAG . ")([^>]*)>(.*?)<\/\\1>\s*/is",
function($r){return "str_replace('\\\"', '\"', '<$r[1]$r[2]>' . Common::cut_paragraph(trim('$r[3]'), false) . '</$r[1]>')";}, $string);
$string = preg_replace_callback("/<(" . self::ESCAPE_HTML_TAG . '|' . self::LOCKED_HTML_TAG . ")([^>]*)>(.*?)<\/\\1>/is",
function($m){return "str_replace('\\\"', '\"', '<$r[1]$r[2]>' . str_replace(array(\"\r\", \"\n\"), '', '$r[3]') . '</$r[1]>')";}, $string);
$string = preg_replace("/<(" . self::GRID_HTML_TAG . ")([^>]*)>(.*?)<\/\\1>/is", "\n\n<\\1\\2>\\3</\\1>\n\n", $string); 复制代码 |
|