<?php
$html = '
</tbody>
</table>
<input type="hidden"
name="prt" value="1" /> <input type="image"
src="/images/add_t_s_c.png" /></form>';$content=preg_replace("xxx","",$html);
echo $content;
?> 像上面的例子,<input>标签里出现了换行,如何通过正则表达式去把换行给去掉呢?
我写了很久,都没办法去掉换行。求高人帮忙~~~~~
$html = '
</tbody>
</table>
<input type="hidden"
name="prt" value="1" /> <input type="image"
src="/images/add_t_s_c.png" /></form>';$content=preg_replace("xxx","",$html);
echo $content;
?> 像上面的例子,<input>标签里出现了换行,如何通过正则表达式去把换行给去掉呢?
我写了很久,都没办法去掉换行。求高人帮忙~~~~~
$html = preg_replace('/(<[^>]*)([\r\n]+)([^>]*>)/', '${1}${3}', $html);
}未测
</tbody>
</table>
<input type="hidden"
name="prt" value="1" /> <input type="image"
src="/images/add_t_s_c.png" /></form>';$content=preg_replace("/([^>])[\r\n]+/x","$1",$html);
echo $content;</tbody>
</table>
<input type="hidden" name="prt" value="1" /> <input type="image" src="/images/add_t_s_c.png" />
</form>
2L兄弟你的办法只适用与我这个例子 要是我的代码中有<p>标签 那里面的内容的回车也给去掉了,有没有更好的办法,考虑得更全面的<?php
$html = '
<tbody>
<table>
<p>fasdsadg
fsadgfsag
sdfafsa</p>
<input type="hidden"
name="prt"
value="1" /> <input type
="image" src="/images/add_t_s_c.png" /><form>';
$content = preg_replace("/([^>])[\r\n]+/x", "$1", $html);
//echo $html;echo $content;
?>